Bulk Enabling Skype for Business Users

Scripts to enable and manage policy for multiple users in Skype for Business or Lync 2013.

====
I've been tidying up some of the scripts I use during deployments, so I thought I'd share some of them. This one that I'm about to go through does the following:

  • Takes a CSV of users
  • Enables them for Skype for Business or Lync 2013 (if they're not enabled already)
  • Applies the conferencing policy
  • Applies the client policy
  • Applies the remote access policy

These are the most common things you'll see when working with users in bulk. The script can be modified to apply anything really - if you're familiar with PowerShell, it's fairly easy to read.

Anyway, let's look at the script. Firstly, you can download it below:

SkypeEnable

Script Pre-Reqs
You must have the Lync PowerShell modules installed on the machine you're running this on - simplest way is to use the scripts on your Front End server(s).

Script Modifications for your Environment
You need to modify a couple of items to make it apply to your environment. These items are:

#Update these variables appropriately
$DefaultPool="LyncPool.ds.co.uk"
$LogFile=".\EnableLOG.txt"
$UserCSV=".\EnableUsers.csv"

They should be pretty obvious.

  • Default Pool: If the CSV doesn't include a pool reference, then it will default to whatever you set this variable to.
  • Log File: Where do you want the log file to be written to?
  • UserCSV: This is the CSV containing the users you want to work on.

Source File Requirements
The script uses a CSV file containing the relevant info for the users that you wish to touch. The minimum data in the CSV is shown below:

2016-03-30MinimumDataForImport

At a minimum, all you need in the CSV if the mail address of the user you want to touch. I alway use the mail address pretty much, as it's usually unique in the organisation.

There are other fields you can include too - shown below:

2016-03-30AllFields

The other fields that the script uses are:

  • RegistrarPool - the target pool that you wish to enable the users on.
  • SipAddress - what sip Address do you want to use? You can include the sip: prefix if you want - the script checks for its presence, and adds it if needs be.
  • ConferencingPolicy - what conferencing policy to apply.
  • ClientPolicy - which client policy to apply.
  • ExternalAccessPolicy - which external access policy to apply.

Note that if any of these fields are empty or blank, the following logic applies:

  • RegistrarPool Missing/Blank - use the default one defined the variable I detailed above.
  • Sip Address Missing - use the Email address.
  • Conferencing/Client or External Access Policy missing then don't touch those policy settings.

Pretty simple really. If the file has
extra columns - say you've done an AD Export for example - then they will be ignored. Only the above fields will be used.

Executing the Scripts
This is very simple. From an elevated PowerShell environment just execute the SkypeEnable.ps1 script with:

.\SkypeEnable.ps1

Note you must have
set-executionpolicy unrestricted otherwise the script won't run.

The start directory where my scripts are looks like this. You can see the PowerShell script, and my CSV file 'EnableUsers.CSV'.

2016-03-30StartDirectory

Running the script results in this output:

2016-03-30ScriptExecution

It even tells you the files & logs to check.

Script Output
The script outputs a couple of check files for you to look at so you can make sure everything has gone as expected. I've used 'EnableLog.txt' for the main log file. In addition, a CSV called 'UserCheck.CSV' is also output. Let's look at each - starting with EnableLog.TXT.
This looks like this. The script tells you what it's doing, and even shows you the PowerShell commands it's using.

The UserCheck.CSV contains a CSV export of the users we've touched, and includes their relevant policies.
For example, have a look here. The CSV file will enable you to check against your original requirements and make sure stuff has applied properly:

2016-03-30CSVCheck


Can I use the script for anything else?
Well, yes. If users are
already enabled for Skype for Business/Lync, you can still specify Conferencing, Client or External Access policies. The script will then apply those policies to those users.

Summary
PowerShell is brilliant at automating common and bulk tasks, it absolutely makes sense to use it. To be fair, I may have over-complicated this script & process - sometimes simpler is easier - however the script process itself can be pretty useful for developing your own stuff. So I hope you find it useful.

You can see a video run through below.













blog comments powered by Disqus