Quickly get an overview of the client agent times in ConfigMgr 2012

Agent_Time_03This time it will be a really short blog post, about showing the client agents and their times. Normally, to see the times of the different client agents it’s necessary to look at the properties of a device, but that’s really time consuming for multiple devices. Also, these agents and their times are shown in two different rows as two different arrays. The only one that can be shown in the console is the Heartbeat Discovery.

This should be possible in an easier way and also providing a better overview.

Script

Actually, this is pretty easy to do in PowerShell. The following PowerShell function gets a list of all devices within ConfigMgr, After that it will loop through all the devices and per device loop through the agents (and their times). In the end, the results of the device name, agent name and agent time will be displayed in an Out-GridView. This allows one to filter on anything in one these three columns.

function Get-AgentTimes { param ( [string]$SiteCode, [string]$SiteServer ) $WorkArray = New-Object System.Collections.ArrayList $Resources = Get-WmiObject -Namespace root/SMS/site_$SiteCode ` -Class SMS_R_SYSTEM -ComputerName $SiteServer foreach ($Resource in $Resources) { for ($i=0; $i -lt $Resource.AgentName.Count; $i++) { $WorkHash = [ordered] @{"Resource Name"=$Resource.Name;` "Agent Name"=$Resource.AgentName[$i];"Agent Time"=` [System.Management.ManagementDateTimeconverter]::` ToDateTime($Resource.AgentTime[$i])} $WorkObject = New-Object PSObject -Property $WorkHash $WorkArray.Add($WorkObject) } } $WorkArray | Out-GridView }

Result

As mentioned in the explanation of the script, it outputs the information to an Out-GridView. This gives a very quick overview of all the devices, their agents and their times. What makes it even better is the filter option. This gives the option to filter on a specific resource, agent or agent time. For an example, see the following:

All agents Filter on a specific agent
Agent_Time_01 Agent_Time_02

Leave a Comment

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