• vadim@workflowexcellence.com
  • Utah, United States

Nintex Workflow – Purge History List Data for a Site Collection

Today I talked to a customer (Kevin Dunn at DH Pace, Inc.) who had a need to purge some data from the Nintex Workflow History List. The NWAdmin tool helps with purging data from the Nintex Workflow history lists and there’s also a way to do it through the Manage History Lists page in Site Settings.

Where we hit a bit of a limitation, is that these only support purging data from a single site at a time. When you have many sites, there’s no simple way to do it. You need to script it. This is especially true if you want it part of a maintenance schedule. Hard coding site urls is not really an option because if you create new sites, you’ll need to update your maintenance scripts.

This partner came up with a great idea, of scripting the purge via PowerShell. The following is a PowerShell script that takes a base url to a site in a Site Collection, and then recursively goes through each subsite and runs the purge.

The one this to notice about the scripts below, is that they are hardcoded to purge history data older than 2000 days. You would need to tweak it to purge what you need. It is also hardcoded to a fake url, so you would need to update the first like with the proper url, or even better, put it in as a command line parameter.

Firstly, let’s start with which product do your want to see? Click the appropriate link below

| Nintex Workflow 2013 In Nintex Workflow 2013, the NWAdmin tool exists in the hive bin. So we don’t need to put in a url to it. It should be available from the Management Shell.

$web = get-spweb http://mysiteurl

function PurgeHistoryListData( $w )
{
    $ws = $w.Webs;
    foreach( $subweb in $ws)
    {
        PurgeHistoryListData($subweb)
    }
    Write-Host 'Purging Nintex Workflow History List Data on site : '$w.Url

    & 'nwadmin.exe' -o PurgeHistoryListData -siteUrl $w.Url -days 2000 -silent
}

Write-Host 'Purging Nintex Workflow History List Data on site : '$web.Url
PurgeHistoryListData $web

Conclusion   I hope this helps someone, because it definitely helped me today.

Leave a Reply

Your email address will not be published. Required fields are marked *