PowerShell Tip of the Week: Get SCOM agent version remotely

In this short article you will find out how to get SCOM agent version. You can also check one of the previous articles about Microsoft Monitoring agent where you can check how to get other useful information like SCOM group name or management server.

SCOM agent version

If you have admin right in Operations Manager console then you can check this directly from SCOM server:

$ServerName = "DC01.powershellbros.com"
(Get-SCOMAgent -Name $ServerName).Version

Another way is to logon to server and get this information from registry:

(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\setup")
(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\setup").AgentVersion 
scom agent version
scom agent version

To check registry entry remotely we have to use Invoke-Command:

$ServerName = "DC01.powershellbros.com"
Invoke-Command -Computername $ServerName -ScriptBlock{ (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\setup").AgentVersion }

#Or with Credential parameter 

Invoke-Command -Computername $ServerName -ScriptBlock{ (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\setup").AgentVersion } -Credential domain\username

For multiple servers we can use the same method as in article for checking SCCM agent version:

Get-Content -path C:\users\$env:username\desktop\Servers.txt | foreach { "{0} - {1}" -f $_, ( Invoke-Command -Computername $_ -ScriptBlock{ (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\setup").AgentVersion }) }

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.