Get-SCOMAlert -criteria 'ResolutionState = "0" AND Severity = "1"'| where-object{($_.MonitoringObjectFullName -eq "Microsoft.SystemCenter.HealthService:SCOM_name.ocean.com" -AND $_.Description -like "*011sql*")} | select -ExpandProperty Description
And below I want to remove some text from the Description filed to get only computer name for the description field:
(((Get-SCOMAlert -criteria 'ResolutionState = "0" AND Severity = "1"'| where-object{($_.MonitoringObjectFull
Name -eq "Microsoft.SystemCenter.HealthService:SCOM.ocean.com" -AND $_.Description -like "*011sql*")}
| select -ExpandProperty Description | Out-String).trim("Computer verification failure for Machine Name:")).Trim()).Trim(" is 0x800706BA. The RPC server is unavailable.")
This below is for all computers:
(Get-SCOMAlert -criteria 'ResolutionState = "0" AND Severity = "1"'| where-object{($_.MonitoringObjectFullNa
me -eq "Microsoft.SystemCenter.HealthService:SCOM.ocean.com" )} | select -ExpandProperty Description | Out-String) | foreach {$_ -replace "Computer verification failure for Machine Name: " -replace " is 0x800706BA.*"} >> scomWarComps.txt
Resolve all this specific warnings using below script:
$comps = gc scomWarComps.txt
foreach ($e in $comps) {
Get-SCOMAlert -criteria 'ResolutionState = "0" AND Severity = "1"'| where-object{($_.MonitoringObjectFullName -eq "Microsoft.SystemCenter.HealthService:SCOM.ocean.com" -AND $_.Description -like "*$e*")} | set-SCOMAlert -ResolutionState 255
}
Brak komentarzy:
Prześlij komentarz