A couples of days ago I had to remove a Management Pack.
I went to the SCOM Console, removed all the dependencies and then tried to delete the Management Pack. A „Please wait“ message popped up on my screen and remained there for about 30 minutes.
Then I got the following error message:
The selected management pack cannot be deleted. This might be because it is currently being deleted or it has already been deleted. If you think this message is in error, try again later.
Ok, the MP I tried to delete was a big one, it discovered more than 30.000 object. So, I tried deleting it again, but with the same result.
Then I tried to delete it with the PowerShell-Command „Remove-SCOMManagementPack„. PowerShell was busy for 30 minutes, and at the end, I got again an error-message:
Remove-SCOMManagementPack : The requested operation timed out.
At line:1 char:61
+ Get-SCOMManagementPack -Name microsoft.windows.server.dns | Remove-SCOMManagemen …
+ CategoryInfo : NotSpecified: (Microsoft.Syste…mentPackCommand:RemoveSCManagementPackCommand) [Remove-
+ FullyQualifiedErrorId : ExecutionError,Microsoft.SystemCenter.Core.Commands.RemoveSCManagementPackCommand
Note: Please be aware that the below described method (deleting any data from the OperationsManager SQL database directly) is labeled as „not supported“ by Microsoft. You can do this only as a last resort and at your own risk.
I remembered that it was possible to delete Management Pack using SQL Stored Procedures. With SQL Management Studio I opened the OperationsManager Database, went to „System Stored Procedures“, scrolled down and right clicked „dbo.p_ManagementPackRemove“.
There I selected „Execute Stored Procedure“:
On the center of SQL Management Studio, the following GUI opened:
All I had to do here was putting the Management Pack ID into the „Value“ field. The ID I got with the PowerShell Command
Get-SCOMManagementPack –Name "Example-MP" | Select-Object
Then I clicked on the „Execute“ Button, and about 30 seconds later the job was done.