cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
simran07
Nintex Newbie

Script for Workflow Count in any specific month

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

Labels: (1)
Reply
2 Replies
fhunth
Nintex Newbie

Re: Script for Workflow Count in any specific month

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_me...  to filter the information you need.

Reply
simran07
Nintex Newbie

Re: Script for Workflow Count in any specific month

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

0 Kudos
Reply