May 8, 2013

TIP #1302: Lync PowerShell - Get-CsUser “RegistrarPool” Front-End Pool (Part 1)

Filed under: Lync Server 2013/2010, Lync for Mac/ OCS 2007 R2, PowerShell, Info/Tips — Desmond Lee @ 12:20 am

It is not uncommon to set a constraint on a result set by piping the output further down the pipeline to the Where-Object cmdlet. Take for instance that you are looking to retrieve all users homed on the Lync Server Front-End Pool identified with a valid FQDN. Using Get-CsUser, you chain the cmdlets as illustrated:

$poolFQDN = “fepool01.swissitpro.ch”
Get-CsUser | Where-Object { $_.RegistrarPool -eq $poolFQDN }

The command statement completed successfully with neither any failure message nor usable data returned. So what could be the reason for this behaviour?

Although running Get-CsUser alone appears to indicate that theĀ  RegistrarPool attribute is a simple string, it is in fact of the type Microsoft.Rtc.Management.ADConnect.Collections.UserPolicy. The actual attribute to check against should read as RegistrarPool.FriendlyName (a [string] object).

Since Get-CsUser supports the -Filter parameter, this is the preferred way to run the query as only the final result set that meets the criteria is returned to the client. This avoids unnecessary overloading of the network and optimizes overall performance.

Get-CsUser -filter { RegistrarPool -eq $poolFQDN }

Tested on Lync Server 2013 and 2010.

This and more exciting news, tips and trick, etc. to track here.

Technorati tags: PowerShell, Microsoft Lync Server/Client /Lync Phone Edition / Lync Mobile

No Comments »

No comments yet.

RSS feed for comments on this post. | TrackBack URI

Leave a comment

You must be logged in to post a comment.

Theme Designed by: Malone Car Hire Ireland