Here is a quick one…

Thanks for the smack in the right direction @patrichard

Also, the man himself Vic Jaswal  @vicjaswal emailed me with an example of how to do it as well thats wicked good. See below.

Another Update: The world-infamous @patrichard also added a version, see below.

Ok this is no fancy script to accomplish this but lets say you need to find all users on a specific pool AND get some additional attributes such as email address. Also in this case assume UPN/SipAddress/WindowsEmailAddress may not match so some easier filtering from Lync\Sfb control may not work.

Get-CsAdUser will get you most of the info, such as Name, SipAddress, WindowsEmailAddress etc but it won’t expose RegistrarPool or the msRTCSIP-PrimaryHomeServer value.

Get-CsUserPoolInfo will get you a users, or all users, or a filtered group of users etc. pool, primary server and so forth. I added a way to get all of the attributes in one place:

Get-CsAdUser -LDAPFilter “(msRTCSIP-PrimaryHomeServer=CN=Lc Services

,CN=Microsoft,CN=1:1,CN=Pools,CN=RTC Service,CN=Services,CN=Configuration,DC=your,DC=domain,DC=here,DC=com)”

| Select-Object firstname,lastname,sipaddress,windowsemailaddress | Out-GridView

You can get the appropriate pool CN a few ways, easiest may to just look at a users attribute value for msRTCSIP-PrimaryHomeServer from the pool your are focusing on. You could also pipe it to a CSV but I love me some Out-Gridview because its easy to copy and paste right form the result pane.

 

 

Example:

NewImage

The ‘Vic Jaswal’ method: 🙂

get-csaduser | select @{l=’samaccountname’;e={$_.samaccountname}},@{l=’Displayname’;e={$_.displayname}},@{l=’mail’;e={$_.mail}},@{l=’SIPAddress’;e={$_.sipaddress}},@{l=’Registrar’;e={(get-csuser -identity $_.sipaddress).Registrarpool}}

 

The @patchichard method 🙂

 

Get-CsAdUser|Select-Object @{l=’SamAccountName’;e={$_.SamAccountName}},@{l=’DisplayName’;e={$_.DisplayName}},@{l=’EmailAddress’;e={$_.WindowsEmailAddress}},@{l=’SIPAddress’;e={$_.SipAddress}},@{l=’Registrar’;e={(Get-CsUser-Identity$_.SipAddress).RegistrarPool}} Out-GridView 



So much fun. Thank you both for the assist.

 

Again there are likely many ways to get this done, and you may have better, but this one is mine 🙂 Please post with comments or links to better ways to do this.

Thanks!