How do I make a policy that disables all workflows in a container

Hello. I am experimenting with a form of versioning for workflows. I have made a container called Archive under Configuration->Polices-Workflow. The point of this container is to store copies of workflows right before a change is done to them. As a safety feature, I am trying to figure out a policy that will automatically disable the workflow copies as they are moved to the archive folder. I created a policy object and I am enforcing the policy object on the archive container. Inside the policy object I have a script policy. This is the script that I am running:

function onPostMove($Request)
{
# Get all workflow objects in the target container and disable them
Get-QADObject -SearchRoot 'CN=Archive,CN=Workflow,CN=Policies,CN=Configuration' `
-Type 'edsWorkflowDefinition' |
Set-QADObject -ObjectAttributes @{edsaWorkflowIsDisabled=TRUE}
}

The script is not disabling workflows when I put them in the archive container. I turned on debug logging for the script and I'm not seeing any obvious errors.

Can someone please help me figure out why the archived workflows aren't getting disabled?

Thanks!

Parents Reply Children
  • Thanks, Richard. That helped. I was trying to run it in ISE to test and I had to add the -Proxy switch. The script runs error free, but isn't actually doing anything. I have a workflow sitting in my archive folder that isn't getting disabled by the script. This is what I am testing in ISE:

    Import-Module ActiveRolesManagementShell

    Get-QADObject -Proxy -SearchRoot 'CN=Archive,CN=Workflow,CN=Policies,CN=Configuration' `
    -Type 'edsWorkflowDefinition' |
    Set-QADObject -Proxy -ObjectAttributes @{edsaWorkflowIsDisabled="TRUE"}

  • One slight change I would suggest to this:

    Get-QADObject -Proxy -SearchRoot 'CN=Archive,CN=Workflow,CN=Policies,CN=Configuration' `
    -Type 'edsWorkflowDefinition' | foreach {
    
    Set-QADObject -identity $_.DN -Proxy -ObjectAttributes @{edsaWorkflowIsDisabled="TRUE"}
    
    }

  • Still no luck, I'm afraid. Is the onPostMove the wrong function to be using here? Here is the debug log from my latest test, The script is seeing that the workflow is being put into the container but it doesn't seem to even attempt to disable it.

    <-------------------------------------------------------------->
    <---- New Debug Session 4/14/2026 10:24:58 AM ---->
    <-------------------------------------------------------------->
    <------------------- $Request XML ------------------------>
    <MoveRequest xmlns:xsd="">www.w3.org/.../XMLSchema" xmlns:xsi="">www.w3.org/.../XMLSchema-instance" dn="CN=Account Activation 10 April 2026,CN=WIP,CN=Workflow,CN=Policies,CN=Configuration" newContainerDN="CN=Archive,CN=Workflow,CN=Policies,CN=Configuration" xmlns="urn:schemas-quest-com:ActiveRolesServer">
    <Controls>
    <Control id="13" />
    <Control id="AllowApproval">
    <Values>
    <Value>Check</Value>
    </Values>
    </Control>
    </Controls>
    </MoveRequest>
    <------------------- $Request XML ------------------------>
    Call: Set-PSDebug -trace 2
    DEBUG: 1+ >>>> s7863721d-1e54-4b60-b8b8-0aed900c52b1 'onPostMove' $Request
    DEBUG: ! CALL function '<ScriptBlock>'
    DEBUG: 10+ >>>> &$args[0] $args[1]

    DEBUG: ! CALL function '<ScriptBlock>'
    DEBUG: 2+ >>>> {

    DEBUG: ! CALL function 'onPostMove'
    DEBUG: 4+ >>>> Get-QADObject -SearchRoot 'CN=Archive,CN=Workflow,CN=Policies,CN=Configuration' `

    DEBUG: 9+ } >>>> }

    <------------------- $Request XML ------------------------>
    <MoveRequest xmlns:xsd="">www.w3.org/.../XMLSchema" xmlns:xsi="">www.w3.org/.../XMLSchema-instance" dn="CN=Account Activation 10 April 2026,CN=WIP,CN=Workflow,CN=Policies,CN=Configuration" newContainerDN="CN=Archive,CN=Workflow,CN=Policies,CN=Configuration" xmlns="urn:schemas-quest-com:ActiveRolesServer">
    <Controls>
    <Control id="13" />
    <Control id="AllowApproval">
    <Values>
    <Value>Check</Value>
    </Values>
    </Control>
    </Controls>
    </MoveRequest>
    <------------------- $Request XML ------------------------>