Using SMLets Beta 3 Post #7–Deleting Any Object in the UI
Published Feb 15 2019 06:51 AM 1,425 Views
First published on TECHNET on May 25, 2011

Sometimes you just want to delete an object in the UI.  That’s easy to do with a console task that uses SMLets.  Here’s how:

First, go to the Library/Tasks view.

Click Create Task.

Give the task a name, description (optionally), choose the Object class as the target class, and choose an MP to store the task in.

SKip the Categories page (don’t select anything).

On the command line page just use PowerShell.exe as the executable and then enter the following as the parameters:

-NoExit -Command "Import-Module SMLets;Get-SCSMObject -Class (Get-SCSMClass -Name System.Entity) -Filter 'DisplayName -eq "$Context/Property[Type='CustomSystem_Library!System.Entity']/DisplayName$"' | Remove-SCSMObject -Force -Confirm"

NOTE: Do not just simply copy/paste the above.  You need to actually select the DisplayName property using the Insert Property button. Otherwise the necessary MP references will not be created behind the scenes.

Update [June 20, 2011] - I've changed this in the 7.0.6555.1 version of the MP to use the FullName instead of the DisplayName since display names that had quotes or double quotes in them were throwing off the parameter sequence.  The best way to handle this would be to pass the ID, but we need to add support to the Get-SCSMObject cmdlet in SMLets to allow a GUID ID to be passed in first.  For now FullName will do the trick.  FullName is the class name + : + the key property values (which would rarely if ever contain a quote or double quote).

The new command looks like this.  Note: you can't use the Insert button to insert the $Context/?$FullName$? - you'll need to just type that in or copy paste it from here:

-NoExit -Command "Import-Module SMLets; Get-SCSMObject -Class (Get-SCSMClass -Name System.Entity) -Filter 'FullName -eq "$Context/?$FullName$?"' | Remove-SCSMObject -Force -Confirm"

Click Next, Create, Close.

Now you will have a new console task in the actions pane on any view in the work items and configuration items workspaces when you have an object selected.

When you click on it a PowerShell window will pop up and confirm that you want to delete the object.  It will first prompt you if you want to delete the object and then it will ask you to commit it.  I don’t know why it does the second prompt but whatever, better safe than sorry I guess.  You need to respond Y to both.


This requires SMLets of course.  You can download it here and install it on all your console machines.

Only administrators will be able to use this task but anybody can see it unless you use user roles to scope away visibility of this task.

If you want to make this task available on a subset of classes instead of all, you can just choose a different target like the incident class, computer class, etc.

I’ve uploaded the management pack for this to the SCSM Gallery on TechNet.

Version history
Last update:
‎Mar 11 2019 08:47 AM
Updated by: