SCSM – Deleting Individual Items

When using System Center Service Manager (SCSM) you can sometimes end up with Incidents, Change Management items or Service Requests that need to be deleted individually. You an carry this out by using a combination of SMLets and PowerShell. INSTRUCTIONS The first thing you will need to do is to download and install SMLets on your […]

scsm deleting individual items
When using System Center Service Manager (SCSM) you can sometimes end up with Incidents, Change Management items or Service Requests that need to be deleted individually. You an carry this out by using a combination of SMLets and PowerShell.
INSTRUCTIONS
The first thing you will need to do is to download and install SMLets on your Service Manager server. Once this is complete you should then go ahead and start up an elevated PowerShell ISE window. Depending on what item you want to delete, copy and paste the below code into your script panel within the PowerShell ISE window:
# Import SMLets import-module smlets # State the required class $class = get-scsmclass | where{$_.name -eq “system.workitem.changerequest”} # Use below to edit/remove all items within the above stated class (the array) # $CRsList = get-scsmobject -class $class # Use below to edit/remove statuses of all items like (below exam is to edit all items with *submit* status) (the array) $CRsList = get-scsmobject -class $class | where{$_.ID -like “CR#####”} # Remove all items stated within the $CRsList Array Foreach ($CR in $CRsList) {Remove-SCSMObject $CR -Confirm:$false -Force} # Change all statuses within the array – you will be prompted for a new status # $CRsList | set-scsmobject –property status
The above code as is will delete a stated Change Request item. Remember to change the #’s for the item number you wish to delete. If you want to delete other items such as an Incident or Service Request, you should amend these values in the code:
  • system.workitem.changerequest
  • $CRsList
  • CR#####
Feedback
If you have any questions or feedback on this post, please feel free to leave us a message below in the comments section.

Discover more from TechyGeeksHome

Subscribe to get the latest posts sent to your email.

Andrew Armstrong

Andrew Armstrong is a UK-based IT professional with 26+ years of hands-on experience in Windows, Windows Server, SCCM/ConfigMgr, Active Directory, PowerShell, and enterprise infrastructure.

He founded TechyGeeksHome in 2010 and has published over 1,500 practical guides covering real-world IT problems and solutions. When not solving IT problems,

Andrew develops free Windows utilities including Ultimate Settings Panel, which has been downloaded over 850,000 times.