free chatting and dating with Admi...
free chatting and dating with Admin Panel
Guide,  Microsoft,  Powershell,  SCSM

SCSM – Deleting Individual Items
0 (0)

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.

Click to rate this post!
[Total: 0 Average: 0]

Free Subscription

If you want to be notified when we post more quality guides like this one, sign up to our free subscription service and you will receive an email when a new post is live.

Join 449 other subscribers.

No need to worry, we will not be filling your inbox with spam and you can unsubscribe anytime you like.

Avatar of A.J. Armstrong

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

Leave us a message...

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