Needed to audit a farm to see if a CodePlex solution was being used in SharePoint Designer workflows. In my case, I needed to see where the iLove SharePoint solution was being used. The script below is only targeted at one web and is looking for word “ILoveSharePoint” in the XML.
#load the SP snapin....
Function GetFiles($folder)
{
foreach($file in $folder.Files)
{
if($file.Name.Split('.')[-1] -eq "xoml")
{
$web2 = Get-SPWeb $file.Web.Url
$wFile = $web2.GetFileOrFolderObject($web2.URL +"/"+ $file.URL)
if ($wFile.Exists -eq "True")
{
1$wXml = (New-Object System.Text.UTF8Encoding).GetString($wFile.OpenBinary());
if($wXml.RootWorkflowActivityWithData.ns0.Contains("ILoveSharePoint"))
{
Write-Host $folder
}
}
}
}
# Use recursion to loop through all subfolders.
foreach ($subFolder in $folder.SubFolders)
{
Write-Host "`t" -NoNewline
GetFiles($Subfolder)
}
}
$web1 = Get-SPWeb "http://SomeWebURL"
$list1 = $web1.Lists["Workflows"]
GetFiles($list1.RootFolder)