I want to find out all the Nintex workflows exists in my SharePoint 2013 Site collection using Power Shell.
Kindly help me on how to identify the workflow as Nintex workflow using Power Shell.
Thanks
Try using below code:
Add-PSSnapin Microsoft.SharePoint.PowerShell
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
[void][System.Reflection.Assembly]::LoadWithPartialName("Nintex.Workflow")
#[void][System.Reflection.Assembly]::LoadWithPartialName("Nintex.Workflow.SupportConsole")
[void][System.Reflection.Assembly]::LoadWithPartialName("Nintex.Workflow.Administration")
[void][System.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(![string]::IsNullOrEmpty($reader["SiteID"]))
{
$Site = $(Get-SPSite -identity $reader["SiteID"])
}
if(![string]::IsNullOrEmpty($reader["WebID"]))
{
$SubSite = $Site.Allwebs[[Guid]"$($reader["WebID"])"]
}
if(![string]::IsNullOrEmpty($reader["ListID"])){
$List = $SubSite.Lists[[Guid]"$($reader["ListID"])"]
}
$row | Add-Member -MemberType NoteProperty -Name "Number Of Workflows" -Value $reader["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
References:
Using the SharePoint site collection UI also, we can get the Nintex workflow details, for that we need to follow the below steps:
The Manage Workflow Inventory will give you all the Nintex Workflows(both list and site) details. We can export this details to csv.
For more details refer to the below article: