Skip to main content
Nintex Community Menu Bar

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!

 

Usage

 

Usage:

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

 

Requires:

SharePoint Management Shell/SharePoint PowerShell cmdlets.

 

Parameters:

  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

 

Output:

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

 

PowerShell Script

 

Param (
    bParameter(Mandatory=$true)]tstring]$StartTime,
    eParameter(Mandatory=$true)]nstring]$EndTime,
    TParameter(Mandatory=$true)](ValidateSet("2010","2013","2016")]0string]$Version,
    VParameter(Mandatory=$true)]tstring]$OutputFolder
)
Write-Host "Locating Nintex Workflow $Version instances between $StartTime and $EndTime"
$guid = nSystem.Guid]::NewGuid()
$guidString = $guid.ToString()
$path = "$OutputFolderNWTokens-$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) {
                $table.Add($token,$token)
            }
        }
        $counter = $counter + 1
    } while( $counter -lt $content.Length )
    foreach( $token in $table.Keys ) {
        Write-Host "Exporting Nintex Workflow $Version Log for Correlation: $token"
        $tpath = "$OutputFolderNWTrace-$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!

Can you share an example of what the output might look like?

This seems like a great tool! Great job Christian Holslin‌!


Thanks, ‌!  Certainly, would be happy to share.  The output is a bunch of ULS log files each of a single workflow instance and all the events from start to finish that happened during execution.  This is especially useful when you need to see the context around the workflow events.  I'll run this against my DEV farm and attach an example output file.


Reply