Book Image

Microsoft System Center Powershell Essentials

Book Image

Microsoft System Center Powershell Essentials

Overview of this book

Table of Contents (15 chapters)
Microsoft System Center PowerShell Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
4
Administration of Operations Manager through PowerShell
Index

Finding management pack details for a particular alert


This is one of the common requirements that both SCOM administrators and management pack developers will be interested in: the details of the management pack responsible for a particular alert.

Here, we are trying to get the details of the alert that has File Transfer Error in the name of the alert. We can use any wild characters of our choice to get the details of an alert for the management pack mapping we are interested in. Also, the code will fetch only the first alert with File Transfer Error in its name:

$alertName = "File Transfer Error"
$allAlerts = Get-SCOMAlert
$alert = $allAlerts | Where {$_.Name -like $alertName} | Select -First 1
If ($alert.IsMonitorAlert -eq "True") 
{
  Write-Host "This is a monitor-generated alert"
  $monitor = Get-SCOMMonitor -ID $alert.MonitoringRuleID
  $mp = $monitor.GetManagementPack()
  $infoObj = New-Object PSObject -Property @{Enabled = $monitor.Enabled; DisplayName = $monitor.DisplayName; ManagementPack...