SCOM 2012: Finding all inactive agents using PowerShell

Knowing that an agent is not reporting is essential, as if the agent is not reporting then the status of all the monitors on the system will not be up to date.

As such I have been looking into doing this and have come up with this:

$Agents  = Invoke-Command -ComputerName $SCOMServer -ScriptBlock {   
        Import-Module -Name OperationsManager
        $AgentClass = Get-SCOMClass -name Microsoft.SystemCenter.Agent
        $UnavailableAgents = Get-SCOMClassInstance -Class $AgentClass | Where-Object {$_.IsAvailable -eq $false -and $_.InMaintenanceMode -eq $false} 
        return $UnavailableAgents | Select DisplayName, Id, Version, HealthState, StateLastModified, IsAvailable, AvailabilityLastModified, IsNew

This should return you basic information about all agents which are inactive, greyed out or uninitialized.

Be the first to like.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.