PowerShell Script to Get All workflows from SharePoint 2010 including custom

Highlighted
Contributor

We had a requirement to get all workflows from SharePoint 2010 platform to review workflow types and their purpose. prior to migration we wanted to review all custom developments hence with help of internet blog, I have developed PS script to achieve this and I hope it will be helpful to the community as well.

Prior to execution and add your web application on it.  

 

Thank you ! 

 

 

Add-PSSnapin Microsoft.Sharepoint.Powershell

#$siteurl = Get-SPWebApplication https:// | Get-SPSite -Limit ALL

$siteurl="https://"

function Get-Workflows($siteurl)
{

$site=Get-SPSite -Limit ALL
$WorkflowDeatils=@()

foreach($web in $site.AllWebs)
{
foreach($list in $web.Lists)
{
foreach($wf in $list.WorkflowAssociations)
{
if ($wf.Name -notlike "*Previous Version*")
{
$row=new-object PSObject
add-Member -inputObject $row -memberType NoteProperty -name "Site URL" -Value $web.Url
add-Member -inputObject $row -memberType NoteProperty -name "List Title" -Value $list.Title
add-Member -inputObject $row -memberType NoteProperty -name "Workflow name" -Value $wf.Name
$WorkflowDeatils+=$row
}
}
}
}
$WorkflowDeatils
}

Get-Workflows | Export-csv C:\SPMigrationReport\workflows.csv
$site.Dispose()

0 Replies