Jens Trier Rasmussen

The odd bit of information about Lync Server 2013, Lync 2010, Exchange 2013, SharePoint Server 2013, Exchange 2010 SP1, OCS 2007 R2, Exchange 2010 and OC 2007 R2

Script to see highest version of a component installed on a OCS/Lync server

Script to see highest version of a component installed on a OCS/Lync server

  • Comments 1
  • Likes

I had been doing some re-installation of my lab and was not sure if I had remembered to install the latest CU on all the servers. I created the following script to give me the highest version of any OCS/Lync component installed on my servers. The highest version is an indication of which CU has been installed, but it doesn’t tell you all CU components have been installed on the server.

The script require Windows Remote Management configured on all the servers (winrm quickconfig) and also that the user running it has the necessary permissions. I’ve run it against OCS 2007 R2 and Lync 2010 CU1 servers. No guarantees and your mileage may vary Smile

$computers = "srv1",”srv2”,”srv3”
$sb = {Get-ChildItem 'hklm:\software\microsoft\real-time communications'| foreach-object {Get-ItemProperty $_.pspath}}
foreach ($computer in $computers)
{
    $all = Invoke-Command -ComputerName $computer  -ScriptBlock $sb
   
    # major.minor.build.patch
    $highest = "0.0.0.0"

    foreach ($i in $all)
    {
   
        # get individual components of version
        $a = $i.Version.split(".")
        $b = $highest.Split(".")
        # calculate a total
        $avalue = ([int]$a[0]*1000)+([int]$a[1]*100)+([int]$a[2]*10)+([int]$a[3])
        $bvalue = ([int]$b[0]*1000)+([int]$b[1]*100)+([int]$b[2]*10)+([int]$b[3])
       
        # Compare totals
        if ($avalue -gt $bvalue)
        {
            # we have a new highest version. Save that
            $highest = $i.Version
        }
       
    }
    write-host "Highest version seen on" $computer "is" $highest
}

Comments
  • THANK YOU.

    The Lync CU system is driving me nuts.  This helps a little.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment