Removing MPs That Don’t Exist!

I’ve come across this little bug a couple of times now. You delete a management pack using the SCSM console, then immediately import it again.

“Whoa, whoa, whoa” I hear you shout.  “Why are you doing that and not incrementing MP version numbers”.  Sometimes it can be easier during testing, particularly when modifying a class property type, or removing class properties.

You go to view your changes and discover SCSM knows nothing about them!  You then go and check the installed MPs to see your MP has vanished from the list!

So you think, “I can’t have imported it, I must have dreamt that”, and try importing again, only to receive an error to say that it already exists in the database.

I’ve seen this occur simply due to the speed in which you delete, then import the MP again, and on systems that are under resourced, either at the workflow server or at the database.

There is a simple fix. Use the following PowerShell command to delete the MP again and give it a minute before importing the MP again.

Import-module SMLets
Get-SCManagementPack | where{ $ -eq "My MP Name" } |Remove-SCSMManagementPack

You’ll need to substitute My MP Name with the name of your problem MP.