Here is a script to add AD users automaticly to Lync 2010
This is the simple way of adding every AD user that isnt allready enabled for Lync 2010:
1 |
Get-CsAdUser -Filter {Enabled -ne $True} | Enable-CsUser -RegistrarPool "XXXXX.domain.com" -SipAddressType SamAccountName |
This is the more controlled option if you have a bigger and more complex environment:
1 2 3 |
Get-QADUser -Enabled -SearchRoot $UserContainers -LdapFilter "(!(msRTCSIP-UserEnabled=TRUE))" -Email "*@domain.com" | Where-Object { $_.DN -Match 'OU=Users' } | ForEach-Object { Enable-CsUser $_.DN -RegistrarPool server.domain.com -SipAddressType SamAccountName -SipDomain domain.lan } |
If you plan to use the second one or the last one make sure that you have Quest AD commands module installed.
This is the one that I use at my domain
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#Add Quest Snapin Add-PSSnapin Quest.ActiveRoles.ADManagement #Import the Lync modules Import-Module "C:Program FilesCommon FilesMicrosoft Lync Server 2010ModulesLyncLync.psd1" # Connect to AD connect-QADService -service 'domain.lan' #Add users Get-QADUser -Enabled -NotMemberOf 'EXCLUDE THIS GROUP' -LdapFilter "(!(msRTCSIP-UserEnabled=TRUE))" -Email "*@domain.com" | where-object { $_.DN -Match 'OU=Users' } | ForEach-Object { Enable-CsUser $_.DN -RegistrarPool server.domain.lan -SipAddressType SamAccountName -SipDomain domain.lan } #Disconnect from AD disconnect-QADService |