Rapid Workflow Error Response with PowerShell

Blog Post created by cholslin Champion on Jun 23, 2017

Workflows do fail. External forces or unforeseen conflicts arise and force us into troubleshooting mode. Deciphering the root cause of the workflow errors can be time-consuming. When it comes to delivering materials to a support team such as Nintex Support we want the most accurate information possible and we want to get it out the door quickly.


To better respond to my clients needs for rapid workflow error remediation, I've come up with a PowerShell script which will process the ULS logs of an on-premises SharePoint farm, locate Nintex Workflow-specific correlation tokens, and output the series of ULS logs directly aligned to all workflow instances over the given time period, all automatically, with minimal input from you, the SharePoint/Nintex administrator.  Have a look!





To output one ULS log file for every Nintex Workflow instance reported in the trace log by SharePoint over a given period of time.



SharePoint Management Shell/SharePoint PowerShell cmdlets.



  1. StartTime - passed to Merge-SPLogFile to identify the start date and time to start searching
  2. EndTime - passed to Merge-SPLogFile to identify the end date and time to end the search
  3. Version - the Nintex Workflow version number which is logged by SharePoint in the trace log
  4. OutputFolder - where you want the ULS log files saved



  1. NWTokens-[Guid].txt: all Nintex Workflow events which occur between StartTime and EndTime
  2. NWTrace-[Guid].txt: one for each Nintex Workflow instance that appears in the trace log


PowerShell Script


Param (
Write-Host "Locating Nintex Workflow $Version instances between $StartTime and $EndTime"
$guid = [System.Guid]::NewGuid()
$guidString = $guid.ToString()
$path = "$OutputFolder\NWTokens-$guidString.txt"
Merge-SPLogFile -StartTime $StartTime -EndTime $EndTime -Area "Nintex Workflow $Version" -Path $path
$content = Get-Content $path
if($content -eq $null) {
    Write-Host "No Nintex Workflow $Version records found in the ULS logs"
} else {
    $counter = 1
    $table = @{}
    do {
        $token = $content[$counter].Substring($content[$counter].Length - 36)
        if([System.String]::IsNullOrEmpty($token) -ne $true) {
            if($table.ContainsKey($token) -ne $true) {
        $counter = $counter + 1
    } while( $counter -lt $content.Length )
    foreach( $token in $table.Keys ) {
        Write-Host "Exporting Nintex Workflow $Version Log for Correlation: $token"
        $tpath = "$OutputFolder\NWTrace-$token.txt"
        Merge-SPLogFile -StartTime $StartTime -EndTime $EndTime -Correlation $token -Path $tpath


This is a Rev.1 and as such could be greatly improved. Comments/suggestions welcome!