Welcome to MSDN Blogs Sign in | Join | Help

Retrieving rules and monitors targeted to a particular class (target)

This question came up several times in various forums so I wanted to post a sample script that shows how you can retrieve the list of both rules and monitors targeted to a particular class (target):

$mc = get-monitoringclass | where {$_.DisplayName -eq 'Windows Server 2003 Logical Disk'}

$rules = $mc.GetMonitoringRules()

$monitoringCrit = [System.String]::Format("TargetMonitoringClassId='{0}'",$mc.Id)

$monitors = Get-Monitor -Criteria:$monitoringCrit

Write-Host "Rules"

Write-Host ""

$rules | Sort-Object DisplayName | ft DisplayName,Name

Write-Host ""

Write-Host ""

Write-Host "Monitors"

Write-Host ""

$monitors | Sort-Object DisplayName | ft DisplayName,Name

Published Wednesday, November 21, 2007 4:28 PM by Boris Yanushpolsky
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# System Center Forum - Verifying Agent Workflow - more options

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker