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
Comments
- Anonymous
March 21, 2008
PingBack from http://www.systemcenterforum.org/verifying-agent-workflow-more-options/