While cleaning up my SharePoint farm for the cloud migration, i ran into an interesting problem. If there are custom activity or action created for your designer workflow, how do you track down which ones uses those custom action or activity.
Here is a simple code to go through a site collection that returns all 2010 workflows that is using your custom action/activity that you created with code.
Here is a simple code to go through a site collection that returns all 2010 workflows that is using your custom action/activity that you created with code.
Add-PSSnapin *sharepoint*
-ErrorAction SilentlyContinue
$encode =
New-Object System.Text.ASCIIEncoding
$site =
get-spsite "type
in url"
foreach($w
in $site.allwebs)
{
foreach($wf in $w.Lists["workflows"].items)
{
if($wf.Name -like "*.xoml")
{
$file =
$wf.File
$data =
$file.OpenBinary()
$test =
$encode.GetString($data)
if($test.Contains("text
to find. usually the namespace of the assembly of custom dll")
-or $test.Contains("more
text"))
{
write-host $w.url $wf.Name
}
}
}
}
No comments:
Post a Comment