As an added bonus to this bonus script, there’s not much you need to do in order to run the thing. Just:
Copy the code and paste it into a text editor.
Save the thing with a .ps1 file extension (e.g., C:ScriptsGet-UsersByOU.ps1).
Run the script from within the Lync Server Management Shell:
Could anything be easier? We doubt it but we’ll let you know if we ever find anything.
As for the script itself, the code kicks off by searching Active Directory and bringing back a collection of all your OUs (objectCategory=organizationalUnit). One-by-one, the script then connects to each OU, using the
cmdlet and the
parameter to return the display name for all the users with accounts in that domain (and, as yet
bonus, also indicates whether those users have been enabled for Lync Server). That’s all it does. But, then again, that’s all it’s
So is this the most important script you’ll ever have in your scripting arsenal? Maybe yes, maybe no. But hey, you can’t beat the price, right?