How to remove the workflow associations on the content type and document library using PowerShell? Currently I have added PowerShell to configure workflow in my document libraries and its associated content types. But other developers from my team also created workflow instances in the same document libraries within my sub sites and site collections. So I want to remove all those unwanted workflow associations and run my PowerShell script again with a fresh WF instance.
if($web.Lists[$tasklistName] -ne $null -and $web.Lists[$historylistName] -
ne $null -and $wfTemplate -ne $null)
{
Write-Host "task lists exists, history list exists, wftemplate exists"
$associationWF=[Microsoft.SharePoint.Workflow.SPWorkflowAssociation]
::CreateListContentTypeAssociation
($wfTemplate, "myConfidentialWFF", $web.Lists[$tasklistName],
$web.Lists[$historylistName]) #$taskList,$historyList)
$ct.WorkflowAssociations.Add($associationWF)
$ct.UpdateWorkflowAssociationsOnChildren($true,$true,$true,$false)
Write-Host "WF association with the content type " $ct.Name "
completed for ..." $web.url "with document library...." $singleDocLibObj
}
else
{
Write-Host "any one of the parameters or arguments is null"
}
} # end of all content types within CT collection
Any methods exist similar to $ct.workflow.assocations.remove
($wfaassocaitonwf)
? So that it removes all the existing instances from the document libraries and content types.