Get SCOM update rollup version remotely

Update Rollup

Checking SCOM update rollup version using console is pretty simple. Things are getting a little bit complicated if we want to get this from server. Using WMI or PowerShell commands like Get-Hotfix probably we will not get this information.

Update Rollup

To check this locally we have to get FileVersion for OMAgentTraceTMFVer.Dll file. Each version is assosiated with one of the Update Rollups. For more information you can visit System Center wiki page:

#Path - C:\Program Files\Microsoft Monitoring Agent\Agent\Tools\TMF\OMAgentTraceTMFVer.Dll
$Version = (Get-Command "C:\Program Files\Microsoft Monitoring Agent\Agent\Tools\TMF\OMAgentTraceTMFVer.Dll").FileVersionInfo.FileVersion
switch($Version)
              {
                # SCOM 2012
                "7.1.10184.0" {"2012 R2 RTM"} 
                "7.1.10195.0" {"2012 R2 UR2"} 
                "7.1.10204.0" {"2012 R2 UR3"} 
                "7.1.10211.0" {"2012 R2 UR4"} 
                "7.1.10213.0" {"2012 R2 UR5"} 
                "7.1.10218.0" {"2012 R2 UR6"} 
                "7.1.10229.0" {"2012 R2 UR7"} 
                "7.1.10241.0" {"2012 R2 UR8"} 
                "7.1.10268.0" {"2012 R2 UR9"} 
                "7.1.10285.0" {"2012 R2 UR11"} 
                "7.1.10292.0" {"2012 R2 UR12"} 
                "7.1.10302.0" {"2012 R2 UR13"} 
                "7.1.10305.0" {"2012 R2 UR14"} 
 
                # SCOM 2016
                "8.0.10918.0" {"2016 RTM"} 
                "8.0.10931.0" {"2016 UR1"} 
                "8.0.10949.0" {"2016 UR2"} 
                "8.0.10970.0" {"2016 UR3"} 
                "8.0.10977.0" {"2016 UR4"} 
              }
Update Rollup remotely

For multiple remote machines we have to use foreach loop and Inovke-Command. In addition script will check agent version and add all results to array.

#Path - C:\Program Files\Microsoft Monitoring Agent\Agent\Tools\TMF\OMAgentTraceTMFVer.Dll

$Results = @()
$Servers =  "ADFS01",
            "ADFS02",
            "ADFS03",
            "ADFS04",
            "ADFS05",
            "ADFS06"

Foreach ($Server in $Servers) {
    $Object = $Agent = $Version = $UR = $Null
    $Server = $Server.trim()
    Write-Host "Processing $Server"
    $Agent = Invoke-Command -Computername $Server -ScriptBlock{(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\setup").AgentVersion}
    If($Agent) {
        $Version = Invoke-Command -Computername $Server -ScriptBlock{(Get-Command "C:\Program Files\Microsoft Monitoring Agent\Agent\Tools\TMF\OMAgentTraceTMFVer.Dll").FileVersionInfo.FileVersion}
        If($Version){
            $UR = switch($Version)
              {
                # SCOM 2012
                "7.1.10184.0" {"2012 R2 RTM"} 
                "7.1.10195.0" {"2012 R2 UR2"} 
                "7.1.10204.0" {"2012 R2 UR3"} 
                "7.1.10211.0" {"2012 R2 UR4"} 
                "7.1.10213.0" {"2012 R2 UR5"} 
                "7.1.10218.0" {"2012 R2 UR6"} 
                "7.1.10229.0" {"2012 R2 UR7"} 
                "7.1.10241.0" {"2012 R2 UR8"} 
                "7.1.10268.0" {"2012 R2 UR9"} 
                "7.1.10285.0" {"2012 R2 UR11"} 
                "7.1.10292.0" {"2012 R2 UR12"} 
                "7.1.10302.0" {"2012 R2 UR13"} 
                "7.1.10305.0" {"2012 R2 UR14"} 
 
                # SCOM 2016
                "8.0.10918.0" {"2016 RTM"} 
                "8.0.10931.0" {"2016 UR1"} 
                "8.0.10949.0" {"2016 UR2"} 
                "8.0.10970.0" {"2016 UR3"} 
                "8.0.10977.0" {"2016 UR4"} 
              }
        }
        Else{
            $UR = " - "
        }
    }
    Else{
        $Agent = " - "
        $UR = " - "
    }

    $Object = New-Object PSObject -Property ([ordered]@{ 
    
          Server                  = $Server
          AgentVersion            = $Agent
          Patch                   = $UR
                    
     })
     $Results += $Object
}
$Results | Format-Table -AutoSize -Wrap

# Export CSV
$Results | Export-Csv -Path C:\users\$env:username\desktop\UR.csv -NoTypeInformation -Force

In one of the previous articles you can find out how to get other SCOM agent information like ManagmentServer or SCOMGrouplink.

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.