Operations Manager 2012 R2 Management Pack Dependencies

I am not proficient at managing Ops Manager.  I am at best a competent tinkerer.  I have been needing to do some clean up on our Ops Manager installation, and clear some management packs that are not used, or just used to generate noise that we subsequently ignore.  That is a bit of an annoying task, with trying to trace down all the dependencies.

To make it easier, I looked for  a script to log the management pack dependencies, version and ID.  I found this post from 2009, but it wasn’t very effective in the current version of Ops Manager. http://www.systemcentercentral.com/list-management-packs-dependencies-powershell-script/

So I decided to write a new one.  Here is what I came up with:

New-SCOMManagementGroupConnection -ComputerName <Your Ops Mgr Server Name>

# Create a new Excel object using COM
$Excel = New-Object -ComObject Excel.Application
$Excel.visible = $True
$Excel = $Excel.Workbooks.Add()
$Sheet = $Excel.Worksheets.Item(1)

# Counter variable for rows
$intRow = 2

$Sheet.Cells.Item(1,1) = “Parent”
$Sheet.Cells.Item(1,2) = “MP Name”
$Sheet.Cells.Item(1,3) = “Version”
$Sheet.Cells.Item(1,4) = “ID”

 

$Sheet.Cells.Item(1,1).Font.Bold = $True
$Sheet.Cells.Item(1,2).Font.Bold = $True
$Sheet.Cells.Item(1,3).Font.Bold = $True
$Sheet.Cells.Item(1,4).Font.Bold = $True
$MPCollection = Get-SCManagementPack
foreach ($_ in $MPCollection) {
$intRow++
$MPParent = $_.Name
#     Write-Host $MPParent
$Sheet.Cells.Item($intRow,1) = $MPParent
$Sheet.Cells.Item($intRow,2) = “*************”
$MPChecking = Get-SCManagementPack -Name $MPParent -recurse
foreach ($_ in $MPChecking){
$intRow++
Write-Host $intRow
$MPName = $_.Name
#         Write-Host $MPName
$MPVersion = $_.Version
$MPID = $_.ID
#         Write-Host $MPID
$Sheet.Cells.Item($intRow,2) = $MPName
$Sheet.Cells.Item($intRow,3) = $MPVersion
$Sheet.Cells.Item($intRow,4) = “$MPID”
}
}

Leave a Reply