Script for Workflow Count in any specific month


Badge +3

Hi Team,

I needed some help on building the Power Shell script that counts all the workflows created in one particular month using Nintex and SPD separately. Can you please help me with this?

Regards,
Simran Sachdeva


2 replies

Userlevel 6
Badge +16

With this script you can list all workflows on a csv file

$siteurl="http://site.domain.com"

$site=Get-SPSite("http://siteName");


#Initialize Workflow Count variable

$workflowcount = 0


#Foreach loop to loop through all webs, and lists with workflow associations, and exclude workflows that have previous versions and write findings to .csv file.


function Get-Workflows()

{

foreach($web in $site.AllWebs)

{

foreach($list in $web.Lists)

{

foreach($wf in $list.WorkflowAssociations)

{

if ($wf.Name -notlike "*Previous Version*")

{

$hash = @{"[URL]"=$web.Url;"[List Name]"=$list.Title;"[Workflow]"=$wf.Name}

New-Object PSObject -Property $hash | Sort-Object


}

}

}

}

}


foreach($web in $site.AllWebs)

{

foreach($list in $web.Lists)

{

foreach($wf in $list.WorkflowAssociations)

{

if ($wf.Name -notlike "*Previous Version*")

{

$workflowcount += 1

}

}

}

}


Get-Workflows | Export-csv E:workflows.csv

"Workflow Count " + $workflowcount >> E:workflows.csv


$site.Dispose()

With this script you can list all workflows on a csv file

Take a look to https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.workflow.workflowassociation_members.aspx  to filter the information you need.

Badge +3

Thanks for providing the script. This is exactly what i was looking for. Also can you confirm how can we identify whether the workflow was created in SPD or it is Nintex workflow?

Regards,
Simran Sachdeva

Reply