Bulk-Deleting Incidents in Service Manager
Every so often you’ll want to clear out test or junk incidents from a System Center Service Manager (SCSM) management group — usually after a lab build, a failed import, or a migration dry run. SCSM doesn’t give you a “select all, delete” button in the console for work items, so the reliable way to do it in bulk is PowerShell.
If you have the SCSM PowerShell module (or the community SMLets module) loaded, the pattern is to pull back every object of the Incident class and pipe it into a remove cmdlet:
Import-Module SMLets
$incidents = Get-SCSMClass -Name System.WorkItem.Incident$ | Get-SCSMObject
$incidents | Remove-SCSMObject
On a management group with a large number of incidents this can take a while and puts real load on the SCSM workflow engine, so run it outside business hours and keep an eye on the workflow and management server logs while it’s running. It’s also worth taking a SQL backup of the ServiceManager and DW databases first — this action is not reversible from within the console.
If you only want to clear a subset (say, everything created before a certain date, or everything in a specific queue), filter the collection before piping it into Remove-SCSMObject rather than pulling every incident in the management group.
Warning: test this against a lab or a small filtered batch first. Removing work items in SCSM is permanent and there’s no recycle bin.
Resources
Get the download
SCSM – Remove all incidents Powershell Script is available as a free download.
Download Now →Gear We Recommend
A few general tech accessories worth having alongside this.
Browse our General Tech Accessories picks on AmazonAs an Amazon Associate, TechyGeeksHome earns from qualifying purchases.
Discover more from TechyGeeksHome
Subscribe to get the latest posts sent to your email.