0 votes

Hello - I'm attempting to configure a Custom Command with a PS script that will return the number of users in one of my Lync Registrar Pools. I've put together a small powershell script below. This script is returning a list of users (first name, last name) and not a user count. Can you assist with modifying this to output a user count instead of a list of names?

import-module Lync
Get-CsUser -Filter {RegistrarPool -eq "S1LyncPool1.mydomain.local"} | ForEach-Object {
$message = $_.Name + ": " + (Get-CsUser -identity $_.Name).Count
$Context.LogMessage($message, "Information")
}

by (350 points)

1 Answer

0 votes
by (216k points)
selected by
Best answer

Hello Michael,

Here you are:

Import-Module Lync
$message = "User Count: " + (Get-CsUser -Filter {RegistrarPool -eq "S1LyncPool1.mydomain.local"}).Count
$Context.LogMessage($message, "Information")
0

Thank you for the speedy responce! Worked like a charm!

Related questions

0 votes
1 answer

Hi all, I get the error below when enabling a user for Lync. I have opened port 5986 for winrm over https and have verified the correct certificates ... winrm quickconfig -transport:https". For more information, see the about_Remote_Troubleshooting Help topic.

asked May 8, 2017 by joshua.amune (50 points)
0 votes
0 answers

Hello, I'm curious again... In this post: Lync Fails when Line URI is used its mentioned that because Adaxes uses PowerShell v2, and the Lync module from Microsoft ... scripts. How then, does Adaxes go about enabling and disabling users for Lync? Thanks.

asked Jan 27, 2016 by EgotisticalGiraffe (350 points)
0 votes
1 answer

I have pieced together a some powershell to enable Lync for a user and then try to apply policies. The user is created but the policies are not: # Get ... for identity "Geary Eppernator". Management object not found for identity "Geary Eppernator". Thanks

asked Nov 23, 2015 by cyspry (480 points)
0 votes
1 answer

I need to be able to change other settings related to the users that get provisioned in Lync. Specifically: Conferencing Policy PIN Policy External Access Policy Archiving Policy ... are not available via the SDK. Is this something that can be accomplished?

asked Apr 29, 2015 by lasership (370 points)
0 votes
1 answer

I'm working on setting up business rule provisioning for Lync and UM. I've cobbled together a couple of scripts which should work by looking at them, but do not always ... Start-Sleep -s 60 } } While ($StopLoop -eq $False) Remove-PSSession -Session $session

asked Apr 29, 2015 by polley (1.2k points)
3,548 questions
3,239 answers
8,232 comments
547,814 users