This Script will return all the Rules which are Monitoring or collecting any events in SCOM.

 

$Cur = Get-Location

Import-Module OperationsManager

$Rules = Get-SCOMRule

$RuleNames = $Rules.Name

foreach ($Rule in $RuleNames)

{

$RuleName = Get-SCOMRule -Name "$Rule"

$Configuration = $RuleName.DataSourceCollection

$RuleConfig = $Configuration.Configuration

If ($RuleConfig -like '*EventDisplayNumber*')

{

Write-Host "RUles $RuleName is an Event collection RUles" -ForegroundColor Green

$Rule >> "$Cur\RuleswithEventDetection.csv"

}

Else

{

Write-Host "Rule $RuleName is not an Event collection RUles" -ForegroundColor Red

$Rule >> "$Cur\RuleswithoutEventDetection.csv"

}

}

Leave a Reply

Your email address will not be published. Required fields are marked *