Quick Post: Pat Richards Get-CsConnections and Polycom devices

Note: To be clear I’m a massive fan of Pat’s work. In fact, I make sure I catch up with him every year when I’m at Ignite! I’ve also been using his Set-CsFeatures.ps1 script since the 2013 days. This is by no means intended as a criticism of his work. Just a quick tip for anyone until Pat addresses this himself.

Update 27/07/19: Pat has already implemented this into the latest beta of his script. I’d expect to see a public version soon.

So for those of you that have used Pat’s Get-CsConnections.ps1 before I’m sure you find it super handy! However as its been around since the Lync Phone Edition days it has a little quirk with Polycom VVX and Trio phones as the phones inject their MAC address in the user agent string. Not something Pat ever expected to deal with.

Meaning if you have more than 1 VVX phone in your environment, your user agent version report looks something like this.

In the spirit of the Microsoft UC community, I have made a quick patch to Set-CsFeatures 3.4 to remove the MAC addresses from the user agent string. So now the output looks like this and shows a count of phones based on the firmware version, instead of every phone in the deployment.

The following changes are required for this to work are the additions of the following lines at line 1082 in Set-CsFeatures 3.4, just after the device name cleanup section

    #clean up Polycom VVX firmware. Removes the Mac Address from the agent string to clean up output, Ignored when using ShowFullClient
     if ($_.ClientVersion.contains('PolycomVVX') -and (-Not ($ShowFullClient))) {
        $clientName = $clientName.substring(0,($clientName.length-13))

    #Clean up Trio firmware too
     if ($_.ClientVersion.contains('PolycomRealPresenceTrio') -and (-Not ($ShowFullClient))) {
        $clientName = $clientName.substring(0,($clientName.length-13))

You will also need to remove the signature at the end of the file as we have now modified it otherwise the checksum will fail and PowerShell wont execute it.
You may also need to change your script execution policy to run unsigned scripts.

A copy of the modified script is available here, with a nice big warning that its been modified and you should go get it from Pat as soon as he fixes it.
The relevant code has already been passed onto Pat for inclusion in his next update. (Maybe he might put it on Github….Maybe)

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.