Automate enabling and disabling Lync / Skype for Business users

Lync / Skype for Business

When I see administrators manually enabling all of their Lync / Skype for Business users it makes me cringe. With just a few lines of PowerShell and a scheduled task you can have users enabled for Lync / Skype for Business automatically. Simply copy the script examples and modify them with your infrastructure details and make a scheduled task on your Lync / Skype For Business Server or non Lync / Skype for Business server through remoting.

The first thing to determine is who should be enabled for Lync / Skype for Business and the required settings to be given to those users. I will provide examples of different scenarios both enabling or disabling users. (All examples only search for Lync / Skype for Business users that are not currently enabled and assume that the Email Address would be the enabled SIP Address.)

Example #1: Enable all users in the company with an e-mail account matching @yourdomain.com for normal Lync use.

Example #2: Enable all users in the company within a specific Active Directory OU and an e-mail account matching @yourdomain.com for normal Lync use.

Example #3: Enable all users in the company with a specific City attribute for normal Lync use with an appropriate registrar pool.

Example #4: Enable all users in the company with a specific City attribute for normal Lync use with an appropriate registrar pool and a specific Location Policy.

Example #5: Enable all users in the company with a specific City attribute for Enterprise Voice with a specific Voice Policy, Dial Plan, Conferencing Policy, Location Policy. (Don’t forget a unique Line URI when you run the Set-CsUser command if one is required.)

Example #6: The following example highlights PowerShell Remoting to remotely execute the enabling of user accounts from a separate computer.

Example #7: The following example highlights looping through multiple cities and setting the proper pool and policies according to that city. This example uses a .CSV file that contains all the cities and their respective settings. You could accomplish the same thing through code by adding a custom object and then adding each city. Using a .CSV file is preferred as it will allow you to add/remove cities in the future without changing the script.

The following are some examples of automatically disabling users from Lync if their Active Directory account is disabled.

Example #1: Disabling Lync / Skype for Business from all users in Active Directory that are disabled.

Example #2: Remotely disabling Lync / Skype for Business from all users in Active Directory that are disabled.

Example #3: As requested, here is the solution to remotely disabling Lync / Skype for Business from all users in an Active Directory group. The key here is adjusting the LDAP Filter to only include members of a particular group.

Feel free to leave a comment with your required scenario and I will update this post with the solution.

Print Friendly, PDF & Email

12 comments

Leave a Reply