SCSM – Deleting Individual Items

System Center
System Center

Table of Contents

Estimated reading time: 2 minutes

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.

Share this content:

Click to rate this post!
[Total: 0 Average: 0]
Avatar for Andrew Armstrong

About Andrew Armstrong

Founder of TechyGeeksHome and Head Editor for over 15 years! IT expert in multiple areas for over 26 years. Sharing experience and knowledge whenever possible! Making IT Happen.

View all posts by Andrew Armstrong

Leave a Reply

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