Move a list from skype for business users to another pool via powershell

Abstract: If you do some bigger maintenance on a Skype for business pool, you would like to move the users from that pool to another and after that you wish to move them back. But you do not wish to remember and type in all the names by hand. So you wish to perform that via powershell.

At first we need to build a list of users on the current pool. If you already have one you can skip that. To build that list run the following inside a Skype for business powershell command:

Get-CsUser -Filter {RegistrarPool -eq “lyncpool.contoso.local”} | Select DisplayName  > C:\00Files\users.csv

That will create our needed CSV file. Check the content inside it to be sure thatw what you need. Now you can perform your tasks. Once done you could use the following script to move the users back.

$File = “C:\00Files\users.csv”
$UserArray = Import-CSV -Path $File

Foreach ($user in $UserArray)
{

$thecurrentuser = $($user.DisplayName)

write-host “will use the following user now: $thecurrentuser”
Move-CsUser -Identity “$thecurrentuser” -Target lyncpool.contoso.local -confirm:$false

}

If you wish to test the script at first and confirm every line, then remove ” -confirm:$false” from it.

Archives