SCSM 2012: Deleting Work Items in Bulk in System Center 2012 Service Manager with PowerShell

While unlikely for production, you may want to reset your System Center 2012 Service Manager lab environment by deleting work items in bulk. Here are some

Service Requests

Get-SCSMClassInstance -Class (Get-SCSMClass -Name System.WorkItem.ServiceRequest) | Where {$_.ID -like “SR*”} | Remove-SCSMClassInstance

Incidents

Get-SCSMClassInstance -Class (Get-SCSMClass -Name System.WorkItem.Incident) | Where {$_.ID -like “IR*”} | Remove-SCSMClassInstance

Change Requests

Get-SCSMClassInstance -Class (Get-SCSMClass -Name System.WorkItem.ChangeRequest) | Where {$_.ID -like “CR*”} | Remove-SCSMClassInstance

 

NOTE: For better performance (for scaling to tens or hundreds of thousands of objects), you should replace the Where clause with the –filter parameter. I’ll follow this post with one on bulk deletion of configuration items (something I do frequently in my test lab) and we’ll look at use of the –filter parameter.

3 thoughts on “SCSM 2012: Deleting Work Items in Bulk in System Center 2012 Service Manager with PowerShell

  1. Pingback: Deleting Work Items in Service Manager

  2. Pingback: Quick Post: Delete SCSM Work Items created before specific date with PowerShell | scsmlab

  3. Pingback: Quick Post: Delete SCSM Work Items created before specific date with PowerShell

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.