PowerShell Script to Get All workflows from SharePoint 2010 including custom

%3CLINGO-SUB%20id%3D%22lingo-sub-211715%22%20slang%3D%22en-US%22%3EPowerShell%20Script%20to%20Get%20All%20workflows%20from%20SharePoint%202010%20including%20custom%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-211715%22%20slang%3D%22en-US%22%3E%3CP%3EAll%2C%20We%20had%20a%20requirement%20to%20get%20all%20workflows%20from%20SharePoint%26nbsp%3B2010%20platform%20to%20review%20workflow%20types%20and%20their%20purpose.%20prior%20to%20migration%20we%20wanted%20to%20review%20all%20custom%20developments%20hence%20with%20help%20of%20internet%20blog%2C%20I%20have%20developed%20PS%20script%20to%20achieve%26nbsp%3Bthis%20and%20I%20hope%20it%20will%20be%20helpful%26nbsp%3Bto%20the%20community%20as%20well.%3C%2FP%3E%3CP%3EPrior%20to%20execution%20add%20your%20web%20application%20on%20it%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3BThank%20you%20!%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAdd-PSSnapin%20Microsoft.Sharepoint.Powershell%3C%2FP%3E%3CP%3E%23%24siteurl%20%3D%20Get-SPWebApplication%20https%3A%2F%2F%20%7C%20Get-SPSite%20-Limit%20ALL%3C%2FP%3E%3CP%3E%24siteurl%3D%22https%3A%2F%2F%22%3C%2FP%3E%3CP%3Efunction%20Get-Workflows(%24siteurl)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%3CBR%20%2F%3E%24site%3DGet-SPSite%20-Limit%20ALL%3CBR%20%2F%3E%24WorkflowDeatils%3D%40()%3CBR%20%2F%3E%3CBR%20%2F%3Eforeach(%24web%20in%20%24site.AllWebs)%3CBR%20%2F%3E%7B%3CBR%20%2F%3Eforeach(%24list%20in%20%24web.Lists)%3CBR%20%2F%3E%7B%3CBR%20%2F%3Eforeach(%24wf%20in%20%24list.WorkflowAssociations)%3CBR%20%2F%3E%7B%3CBR%20%2F%3Eif%20(%24wf.Name%20-notlike%20%22*Previous%20Version*%22)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%24row%3Dnew-object%20PSObject%3CBR%20%2F%3Eadd-Member%20-inputObject%20%24row%20-memberType%20NoteProperty%20-name%20%22Site%20URL%22%20-Value%20%24web.Url%3CBR%20%2F%3Eadd-Member%20-inputObject%20%24row%20-memberType%20NoteProperty%20-name%20%22List%20Title%22%20-Value%20%24list.Title%3CBR%20%2F%3Eadd-Member%20-inputObject%20%24row%20-memberType%20NoteProperty%20-name%20%22Workflow%20name%22%20-Value%20%24wf.Name%3CBR%20%2F%3E%24WorkflowDeatils%2B%3D%24row%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%24WorkflowDeatils%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3EGet-Workflows%20%7C%20Export-csv%20C%3A%5CSPMigrationReport%5Cworkflows.csv%3CBR%20%2F%3E%24site.Dispose()%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-211715%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-212023%22%20slang%3D%22en-US%22%3ERe%3A%20PowerShell%20Script%20to%20Get%20All%20workflows%20from%20SharePoint%202010%20including%20custom%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-212023%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20sharing!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

All, 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 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()

 

1 Reply
Highlighted