Get all the workflows in SharePoint server 2013

Hi All,

I am looking for PowerShell script which lists all the workflows (Site workflow and list workflow) for site on SharePoint Server 2013. These are some PowerShell scripts that are available online
http://geekswithblogs.net/bjackett/archive/2010/07/12/powershell-script-to-find-instances-of-running-sharepoint-workflow.aspx http://sharepointrelated.com/2011/11/21/get-all-workflows-in-all-sites-and-lists/ http://sharepoint.stackexchange.com/questions/15388/find-all-spd-workflows-in-site-collection

I ran these above scripts but I get 0 count although there are couple of Site and List workflow on the site as they are either SharePoint server 2007 or SharePoint 2010.

Any help regarding listing all the workflows for SharePoint 2013 would be greatly appreciated. Thanks in advance.  

July 27th, 2015 10:02pm

Hi Sandy,

Can you try this script, It gives all the workflows excluding previous versions, if you got any other language on FARM modify code accordingly. It also, saves data in txt or csv file as specified by you.

param ([boolean] $writeToFile = $true)
#Get List of all workflows in farm
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#If boolean is set to true, you can specify an outputlocation, to save to textfile.
if($writeToFile -eq $true)
{
	$outputPath = Read-Host "Outputpath (e.g. C:\directory\filename.txt)"
}
#Counter variables
$webcount = 0

#Get all webs
Get-SPSite -Limit All | % {$webs += $_.Allwebs}
if($webs.count -ge 1)
{	

	Add-Content -Path $outputPath -Value "Web URL,List Name,Workflow Name"
	#Iterate through all webs
	foreach($web in $webs)
	{
		#Grab all lists in the current web
		$lists = $web.Lists
		foreach($list in $lists)
		{
			foreach($wf in $list.WorkflowAssociations)
                {
					#Ignore previous versions - Check for other languages too
					if($wf.Name -like "*Previous*")
					{continue}	
					
					#Read Workflow instance XOML file					
					write-host "`Iterating workflows: " $wf.Name -ForegroundColor "Yellow"

					Add-Content -Path $outputPath -Value "$($web.url),$($list.title),$($wf.Name)"						
                }
		}
		$webcount +=1
		$web.Dispose()
	}
	#Show total counter for checked webs & lists
	Write-Host "Amount of webs checked:"$webcount

	$webcount = "0"
}
else
{
	Write-Host "No webs retrieved" -ForegroundColor Red -BackgroundColor Black
	$webcount = "0"
}

Free Windows Admin Tool Kit Click here and download it now
July 28th, 2015 1:20am

Hi Rupesh, 

Thanks for your script. 
But in my environment it showed 0 workflows and in that site has 4-5 list and site worklflows.

My Environment is SharePoint 2013 with Workflow manager.
The script might have worked for SharePoint 2010.

Thank you.

   

August 4th, 2015 7:42pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics