Products: Nintex Workflow 2013, Nintex Workflow 2010
Occasionally a history list grows to a point where you can no longer utilize NWAdmin to trim the list (Read this article to avoid this: Defensive Workflow Design Part 1 - Workflow History Lists ). In order to get rid of the items and not impact the entire farm, it becomes necessary to utilize paging and indexing to specifically target each item and delete it. Paging helps throttle the traffic to your SQL server down by only deleting x number of items at a time before it rests and starts again. Indexing enables the targeting of items without the performance overhead of enumerating and/or querying a large collection of items.
Using this PowerShell script large history lists can be purged utilizing paging and indexing.
To use the script do the following:
- Replace http://contoso.com with the URL of the site you wish to execute the script against.
- Replace NintexWorkflowHistory with the title of the history list you wish to target.
Note: By default the script will delete 1000 items and then rest for 1 second.
Filtering can be added by adding an if statement around the Delete() call as shown below. In this example, the item would be deleted if it was older than 01/01/1999.
Version History and other scripts can be found here: http://ALPS.Codeplex.com