aaron.labiosa@nintex.com

How to quickly identify Nintex Content Type usage in SharePoint

Blog Post created by aaron.labiosa@nintex.com Champion on Dec 31, 2015

Products: Nintex Workflow 2013, Nintex Workflow 2010

 

This article provides instructions on how to locate all lists and sites in a farm that are utilizing Nintex Workflow Content Types.

 

WARNING: This script is fairly resource intensive. It is recommended to run this script in a non-production environment to gauge its impact.

 

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 -ErrorAction SilentlyContinue
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
[void][System.Reflection.Assembly]::LoadWithPartialName("Nintex.Workflow")
[void][System.Reflection.Assembly]::LoadWithPartialName("Nintex.Workflow.Administration")

function Get-NintexContentTypeIDQuery{
"0x0108010064E42B14ADA442C78E98D686760A8493|0x010801005CC0A86910A24687A76ECAC954D3E3F3|006EBD0FA4731041D9804386A7FEA568DC|000568DBB766D0491684897A230753AAF9|0x0108010079DBDE612F7B46928C6A2516BA2CAE37|0x0108010079DBDE612F7B46928C6A2516BA2CAE3700E0B65C5281234030AA8CA4D8F8910E72|0x0108010079DBDE612F7B46928C6A2516BA2CAE3700D4A837248A47E040ABD1A569613E898B|0x01010024055591300C45C3B4C2854A24EF05CE|0x010100F815D979DC2B4F48A9DBCA64AED3C636|0x010100F8376F5313D041EF85718B229F4FBFA8"
}

function Get-SharePointWebsContainingNintex {
PARAM
(
[Parameter(ValueFromPipeline=$true)] [Microsoft.SharePoint.SPSite] $SPSite
)

BEGIN {
  }

END {
}

PROCESS {
  if ($($SPSite.OpenWeb().ContentTypes | Where {$_.Id -match $(Get-NintexContentTypeIDQuery)}).Count -gt 0){
  $SPSite.OpenWeb()
  }
 
  $SPWeb = $null
  $SPSite = $null
  [GC]::Collect()
}
}

function Get-SharePointListCollection {
PARAM
(
[Parameter(ValueFromPipeline=$true)] [Microsoft.SharePoint.SPWeb] $SPWeb
)

BEGIN {
  }

END {
}

PROCESS {
  $SPWeb.Lists
  $SPWeb = $null
  [GC]::Collect()
}
}

function Get-SharePointListContainingNintex {
    [CmdletBinding(DefaultParameterSetName = "frompipe")]
PARAM
(
    [Parameter(
        Mandatory=$true,
        ValueFromPipeline=$true,
        ParameterSetName="frompipe"
        )]
        [Microsoft.SharePoint.SPList]$SPList
)

BEGIN {
  }

END {
}

PROCESS {
   
  [bool]$HasContentType = $false

  foreach ($SPContentType in $SPList.ContentTypes){
 
   if ($SPContentType.Id -match $(Get-NintexContentTypeIDQuery)){
    $HasContentType = $true
   }
 
  }
 
  if($HasContentType){
   $SPList
  }

  $SPList = $null
  [GC]::Collect()
}

}

Get-SPSite | Get-SharePointWebsContainingNintex | Get-SharePointListCollection | Get-SharePointListContainingNintex | FT Title, ParentWeb

 

Additionally, the properties returned can be changed by appending properties to the end of the script (default is ParentWeb, Title).

Outcomes