Share via


SCOM 2012 Troubleshooting: re-mediate unhealthy Agent State

When encountering unhealthy (warning or critical) health agent state within your SCOM 2012  environment.  You need to  Flush Health Service State and Cache. This effectively stops the HealthService  (Microsoft Monitoring Agent) service

Deletes the cache which sometimes can grow large and cause High IO issues and restart the service.

In order to  to re-mediate this issue the issue, You can perform this manually or using PowerShell

 

1-Manually within the SCOM Console

  • Monitoring
  • Expand to Agent Details
  • Select the computers that are in Warning or Critical Agent State
  • On the right hand under tasks
  • Flush Health Service State and Cache

2- Using PowerShell that loops through a list of computer names in C:\scripts\computers.txt

# Start Script   #####

#Paul Zanbaka

# 12/29/2016

#Flush Unhealthy Agent State in SCOM

import-module OperationsManager

foreach ($computer1 in get-content c:\Scripts\computers.txt) {

    

Write-Host  $computer1

Stop-Service -InputObject $(Get-Service -Computer  $computer1 -Name HealthService)

Start-Sleep -s 22

Remove-Item “\$computer1\c$\Program Files\Microsoft Monitoring Agent\Agent\Health Service State\Health Service Store\”

Start-Sleep -s 22

Start-Service -InputObject $(Get-Service -Computer $computer1 -Name HealthService)

}

# end of script

And voila the Health Services Store cache is deleted and recreated.