One of the first posts was about how to get Lync Server Component versions:
Lync Server Component Version with PowerShell (WMI Classes)
In that post, we used Get-WmiObject to query the server. Nevertheless, using that method can be slow, and for sometime it was the only one we knew.
In the post Hey, Scripting Guy! Blog – Use PowerShell to Find Installed Software, Ed Wilson describes a method to query Windows Registry in order to get all installed software. We could adapt it to get Lync Server related information only:
Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | ?{$_.DisplayName -like “*Lync Server*”} | Sort-Object DisplayName | Select DisplayName, DisplayVersion, InstallDate | Format-Table -AutoSize
We run both to see the difference in execution time:
Using Get-WmiObject
Using Get-ItemProperty
We can see how much quicker it is using the Get-ItemProperty. In this Front End, it only took 0,42 seconds to get the results, while on the same server the Get-WmiObject method took 32,39 seconds. Please keep in mind that these results may vary in your environment. Another advantage is that we get the InstallDate, which means we know when the last update was installed. In this example, the date format is YYYYMMDD.