Long Time

It has been a while since my last post. I need to get better at this.
Today, I want to talk about SCOM ACS and agents that are not connected.
We use ACS to monitor some sensitive stuff so if a server isn’t connected, that poses a monitoring problem. With a decent number of ACS collectors, it isn’t feasible to log into each collector and check its health. Likewise, the graph in the SCOM console isn’t real time, isn’t always accurate nor does it tell you exactly which server is the problem.

To help with this, I wrote a PowerShell script to address the needs. Log into a single collector, doesn’t even need to be in the management group nor do you need to be a SCOM admin to run the script, then run the script. Easy as that.

$collector = 

[hashtable] $output = @{}
[int] $count = 0

foreach($item in $collector)
    $dcs = C:\Windows\System32\Security\AdtServer\AdtAdmin.exe -s -c:$item | ConvertFrom-Csv | Select Name,Version,Connected,"Last Action"

    foreach($dc in $dcs)
		if($dc.Version -ne 0 -AND $dc.Connected -eq 0)
            $output.Gateway = $item
            $output.Name = [string]$dc.Name
            $output.Version = [int]$dc.Version
            $output.Connected = [int]$dc.Connected
            $output.LastAction = [string]$dc."Last Action"


           Write-Host "$($count) : $($output.Values)"
if($count -eq 0)
	Write-Host "All servers are reporting healthy"

It is that simple. Of course, it could use some error checking, etc. but you get the idea. This script will return the collector server, server name, version, its connected status and the last connection time.
If you change the if statement at the top just inside the foreach loop, you can return everything or you can leave it as-is and return only those servers where the connection state is 0 or disconnected.
I added the $dc.Version -eq 0 in the if statement because when you move a server from one collector to another, the server stays in the list on the original collector but the version on the server is changed to 0 meaning the server is no longer pointed to that collector.

I hope you find this helpful!


Leave a Reply