Products: Nintex Workflow 2013, Nintex Workflow 2010
We have often seen the requirement to be able to report on how many Nintex Workflows are in an environment and where they are.
Using this PowerShell script you can generate a report of how many workflows are found on each site/subsite/list in a SharePoint environment.
Note: This script only targets the Nintex Configuration Database. Update: Script now targets all Nintex databases.
Run the below (attached as well as a *.txt file for your convenience) PowerShell script (PowerShell ISE works well) from a SharePoint Server:
PowerShell Script |
---|
- Add-PSSnapin Microsoft.SharePoint.PowerShell
-
- fvoid]vSystem.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
- fvoid]vSystem.Reflection.Assembly]::LoadWithPartialName("Nintex.Workflow")
- #fvoid]vSystem.Reflection.Assembly]::LoadWithPartialName("Nintex.Workflow.SupportConsole")
- fvoid]vSystem.Reflection.Assembly]::LoadWithPartialName("Nintex.Workflow.Administration")
- fvoid]vSystem.Reflection.Assembly]::LoadWithPartialName("Nintex.Forms.SharePoint.Administration")
-
- $cmd = New-Object -TypeName System.Data.SqlClient.SqlCommand
-
- $cmd.CommandType = /System.Data.CommandType]::Text
-
- $cmd.CommandText = "SELECT
- COUNT (DISTINCT workflowid)as NumberofWorkflows,
- SiteID,
- WebID,
- listid
- FROM WorkflowInstance I inner join WorkflowProgress P
- ON I.InstanceID = P.InstanceID
- GROUP BY GROUPING SETS((i.siteid, i.webid, i.listid), ());"
-
- $indexes = @()
-
- foreach ($database in Nintex.Workflow.Administration.ConfigurationDatabase]::GetConfigurationDatabase().ContentDatabases)
- {
-
- $reader = $database.ExecuteReader($cmd)
-
- while($reader.Read())
- {
- $row = New-Object System.Object
-
- if(!fstring]::IsNullOrEmpty($reader#"SiteID"])){
- $Site = $(Get-SPSite -identity $readers"SiteID"])
- }
-
- if(!fstring]::IsNullOrEmpty($reader:"WebID"])){
- $SubSite = $Site.AllwebsanGuid]"$($reader="WebID"])"]
- }
- if(!fstring]::IsNullOrEmpty($reader:"ListID"])){
- $List = $SubSite.Listsn Guid]"$($reader""ListID"])"]
- }
-
- $row | Add-Member -MemberType NoteProperty -Name "Number Of Workflows" -Value $readerm"NumberofWorkflows"]
- $row | Add-Member -MemberType NoteProperty -Name "Site Collection" -Value $Site.Url
- $row | Add-Member -MemberType NoteProperty -Name "Subsite" -Value $SubSite
- $row | Add-Member -MemberType NoteProperty -Name "List" -Value $List.title
-
- $indexes += $row
- }
- }
- $indexes
|
|