Thursday, June 20, 2013

Enable multiple Lync Server 2010 users using PowerShell

The Lync Server 2010 (LS) has a few new interfaces, and one of them is the Lync Server Management Shell. This is a Windows PowerShell based shell, with more than 530 Lync related commands. Each command contains "-Cs" characters, as "Communications server", so commands are easy to list. Simply type the Get-Command *-cs*.

  Get-Command *-cs*  

What can we do if we need to enable a huge number of new Lync users? The answer is the automatization, let me show you my Enable-multipleLSusers script!

First of all we need a database with required inputs. I used comma separated values (CSV) file to store the script required properties of all new users. Here is my CSV file:

  Identity;pool;SIPDomain  user1;lync.example.local; example.local   user2;lync.example.local; example.local  

My script reads the CSV file, and enables LS users. Here is the script:

  cls  Write-Host "##########################################"  Write-Host "#                                        #"  Write-Host "#      Enable multiple LS2010 users      #"  Write-Host "#        created by: Attila Tokai        #"  Write-Host "#                                        #"  Write-Host "##########################################"  Write-Host ""    $usercsv = Import-Csv ./CSusers.csv -Delimiter ';'  ForEach ($usr in $usercsv)  {  Enable-CsUser -Identity $usr.Identity -RegistrarPool $usr.pool -SipAddressType SAMAccountName -SipDomain $usr.SIPDomain  Write-Host "	The user " $usr.Identity " enabled for LS2010 "  }  Write-Host "Enable multiple LS2010 users script finished!"  Write-Host ""  

Enjoy!


http://letitknow.wordpress.com/2011/05/23/enable-multiple-lync-server-2010-users-using-powershell/

No comments:

Post a Comment