There are occasions when a SCOM agent goes into a “not monitored” or “gray” state, to troubleshoot this we normally perform a “clear cache” of the agent.
I have created a simple script that clears the cache on the monitored server agent, this script can be run both locally and remotely.
The script will do the following steps:
1. Stop the Microsoft Monitoring Agent service.
2. Check the Microsoft Monitoring Agent service status.
3. Rename the existing “Health Service State” folder.
4. Start the Microsoft Monitoring Agent service.
5. Check the Microsoft Monitoring Agent service status.
6. Remove the old “Health Service State” folder.
7. Done.
The Script
$Server = Read-Host "Please enter your server name" $Service = Get-Service -Name HealthService -ComputerName $Server Write-Host "`n1. Stopping the Monitoring Agent service...`n" Stop-Service $Service Write-Host "2. Checking the Monitoring Agent service status:" Write-Host "`nMonitoring Agent service status: "-nonewline; Write-Host $Service.Status -Fore Red Start-Sleep -s 3 Write-Host "`n3. Renaming the existing 'Health Service State' folder to 'Health Service State Old' `n" Rename-Item -Path "\\$Server\C$\Program Files\Microsoft Monitoring Agent\Agent\Health Service State" -NewName "Health Service State Old" Write-Host "4. Starting the Monitoring Agent service...`n" Start-Service $Service Start-Sleep -s 3 Write-Host "5. Checking the Monitoring Agent service status:" Write-Host "`nMonitoring Agent service status: "-nonewline; Write-Host $Service.Status -Fore Green Write-Host "`n6. Removing the 'Health Service State Old' folder." Remove-Item -Path "\\$Server\C$\Program Files\Microsoft Monitoring Agent\Agent\Health Service State Old" -Recurse Write-Host "`n7. Done!"
Download the script from here:
SCOM Agent Clear Cache
12,315 total views, 18 views today
I have tried the steps and its working for me
Hi Leon,
I am facing the same as like below mentioned issue with the same event id. I think you are part of the conversation. Can you please assist me on this.
https://social.technet.microsoft.com/Forums/en-US/cddcc166-0bba-43d0-b154-23331a52e16d/unable-to-create-new-view-in-scom-web-console-1807?forum=operationsmanagergeneral
Thanks,
Nan
You can also use this:
https://github.com/v-bldrum/SCOM-Scripts-and-SQL/blob/master/Powershell/Clear-SCOMCache.ps1