I am trying to figure out it what properties of $list or $wp return the status of workflow(Completed, In progress, Error Occurred and canceled). or how i can get the status of each workflow in the SP Farm. I managed to get Url, List name and etc. except workflow status.
$siteurl = Get-SPWebApplication https:// | Get-SPSite -Limit ALL
$siteurl="xxx"
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 "RootFolder" -Value $list.RootFolder add-Member -inputObject $row -memberType NoteProperty -name "Workflow name" -Value $wf.Name
Status of workflow ?
$WorkflowDeatils+=$row } } } } $WorkflowDeatils }
Get-Workflows | Export-csv C:\workflow.txt $site.Dispose();