SCOM 2012: Getting Management Pack Dependents

Ran into an issue where an MP needed to be removed from the environment, but there are custom MPs that have a dependency on the one I am about to remove.  One approach to identify the MPs that need to be dealt with prior to removal is to flat try to remove the MP from the environment.  If there are dependencies, you will get a dialog box like this:

image

This works, however, there are two drawbacks

1. It is way too easy to just click ‘Ok’ if the actual delete dialog box comes up and maybe you need to wait for a change window, and

2. You cannot copy any information from this dialog.  You could screenshot it, but if there are several items in this list, manually dealing with them could be something of a pain.

PowerShell seems like the right way to go.

# Get all SCOM MPs in the environment
$AllManagementPacks = Get-SCOMManagementPack

# Replace with the MP you are looking to find the dependents of
$MPToFind = $AllManagementPacks | where{$_.Name -eq ‘Microsoft.Windows.Server.ClusterSharedVolumeMonitoring’}

$DependentMPs = @()

# Iterate through and identify the MPs that have the specified MP listed as a reference
foreach($MP in $AllManagementPacks) {
$Dependent = $false
$MP.References | foreach{
if($_.Value.Name -eq $MPToFind.Name) { $Dependent = $true }
}
if($Dependent -eq $true) {
$DependentMPs+= $MP
}
}

#List out of the dependent MPs
$DependentMPs | ft Name

This will dump a list of the MPs that are dependent on the MP in question to the screen.  From here, you could even go so far as to export them if they are unsealed and then work through identifying if the dependency is necessary and how best to remediate.  This will allow for a more thorough implementation plan when documenting the change.  It may also prove to be a roadblock to the actual removal but at least the information is in hand prior to the change window.

Management Packs, SC Operations Manager

Leave a Reply