Can't import sealed mp when group is removed from old mp

I had an issue with my SCOM.Cmdb mp where I added a group (and imported the mp) but I wanted to change the name of the group. I did a search/replace, sealed it then imported and got this error:


There doesn't seem to be a fix for this, so I had to delete all mp dependencies and the sealed mp then re-import the new sealed mp and override mps using scripts. Nasty but it worked.

Update 29/5/2023.

Got this same error today when I tried to remove the McAfee mp and import the new Trellix mp. For some strange reason the SCOM.Cmdb mp had a reference to McAfee, but it also had code in there to populate the McAfee group, so I removed all McAfee bits (including the reference) then when I went to import, got the error.

These are the steps I followed to fix the problem:

  • Export all unsealed mps.
  • We need to remove the SCOM.Cmdb mp, to do that we need to remove mps that depend on it which unfortunately is all our override mps. To get a list of them:

$AllManagementPacks = Get-SCOMManagementPack
$MPToFind = $AllManagementPacks | where{$_.Name -eq "SCOM.Cmdb"}
$DependentMPs = @()
foreach($MP in $AllManagementPacks) {
$Dependent = $false
$MP.References | foreach{
if($_.Value.Name -eq $MPToFind.Name) { $Dependent = $true }
}
if($Dependent -eq $true) {
$DependentMPs+= $MP
}}
$DependentMPs | ft Name

  • Copy output to C:\temp\file.txt.
  • Get a backup of them:

$a=gc "c:\temp\file.txt"
foreach ($i in $a) {
Get-SCOMManagementPack -name $i | Export-SCOMManagementPack -Path "D:\MP\Backup"
}

  • Now delete them:

$a=gc "c:\temp\file.txt"
foreach ($i in $a) {
write-host "Removing MP $i"
Get-SCOMManagementPack -name $i | Remove-SCOMManagementPack
}

  • You should be able to remove SCOM.Cmdb mp now.
  • You should be able to remove McAfee mp as well.
  • Import the new SCOM.Cmdb mp.
  • Import override mps again but first add .xml extension to all mps in C:\temp\file.txt:

$a=gc "c:\temp\file.txt"
foreach ($i in $a) {
write-host "Importing MP $i"
Import-SCOMManagementPack -path "D:\MP\Backup\$i"
}

  • Import Trellix mp.
Note: This is a guide only, I wasn't able to document each exact thing that happened.

Summary

This worked but it's extreme having to remove all those override mps. A very strange thing happened because of this I believe. Because I removed the override mps, alerts were coming through thick and fast, however, after importing them again, the alerts didn't automatically close (I think that might be normal). When I closed them in the console (there were about 600) they would come back about 20 mins later. I'd close them again and they would come back. I ended up bouncing all services on all mgmt servers and it settled down after that.

Comments