Migrating Users in Skype For Business

I recently had to migrate a ton of users from one Skype For Business Pool to a new one.

Step 1: Get the Users

To get started we wanted to to see what we were working with so I wrote the following Powershell script that output a CSV file with all of our users that we wanted to migrate in it.

$dayStart = get-date
$dayEnd = $dayStart.AddDays(-300)
get-aduser -Filter ‘Enabled -eq $true -and lastlogondate -gt $dayEnd -and  UserPrincipalName -notlike “system-*” -and mail -ne “$null”‘ -properties *  | Select-Object DisplayName, SAMAccountName, Department, SipAddress, Enabled, LastLogonDate, msRTCSIP-UserEnabled, msRTCSIP-PrimaryUserAddress | Export-CSV c:\Existing_Lync_Users.csv

You can add as many parameters as you want to the filter and there is some interesting information here on how to structure your WHERE clauses.  For me I wanted to make sure the user was enabled, had logged in at least once in the past 300 days and the account was not an admin type account (note the above ‘system-‘ filter is made up and not the real one).

From there, this exported all the information into a handy, dandy CSV file that I could filter as I saw fit.

Step 2: Move the Users

Import-Csv c:\Existing_Lync_Users.csv | ForEach-Object {Move-CsUser -Identity $_.UserPrincipalName -Target “new-pool-name” -Confirm:$False}

If I was using the outputted CSV file at face value, I could run the following to migrate all our users, but you can take your original CSV and filter by department or some other value to minimize the resultset.  For each row that was found, I executed the Move-CsUser comand to the new target pool and disabled the confirmation so it would not prompt me for each user.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s