For example, In SCOM if you want to retreive all alerts from a management packs, you can do something like this
$crit=""
$count=0
$count=0
get-managementpack | ? { $_.Name -match "Citrix"} | % { $_.getclasses() | % {
If ($count -eq 0) {$crit= "MonitoringClassId = '"+$_.id.tostring()+"'"; $count++}
else { $crit= $crit + "OR MonitoringClassId = '"+$_.id.tostring()+"'" }
}}
get-alert -criteria $crit
If ($count -eq 0) {$crit= "MonitoringClassId = '"+$_.id.tostring()+"'"; $count++}
else { $crit= $crit + "OR MonitoringClassId = '"+$_.id.tostring()+"'" }
}}
get-alert -criteria $crit
This powershell script retreive Citrix alerts...
Aucun commentaire:
Enregistrer un commentaire