Listing and exporting gray agents in SCOM
SCOM administrators need to list and troubleshoot gray agents in SCOM. You can access the Microsoft TechNet link https://technet.microsoft.com/en-in/library/hh212723.aspx for more details on gray agents. Here is a test code that will list all the gray agents and export the results in a text file. We can use this file as a reference for further troubleshooting or we can automate the troubleshooting process by feeding this file as an input to other code that will carry on the troubleshooting activities:
$class = Get-SCOMClass -Name "Microsoft.SystemCenter.Agent" $mObject = $class | Get-SCOMMonitoringObject | Where-Object { $_.IsAvailable -eq $false} $mObject | select DisplayName