Enable Lync and Apply policy for Bulk users in AD Group

Case

Need to check for users in AD Group that are not enabled for lync and enable these users using e-mail address and apply policy to these users after 30 sec from users creation

Solution

Run below Script

Import-Module ‘C:\Program Files\Common Files\Microsoft Lync Server 2010\Modules\Lync\lync.psd1’    ##In-case Lync 2010
Import-Module activedirectory
$groupmember = Get-ADGroupMember “Group name”    ##i.e Domain Admins
foreach ($member in $groupmember)
{
$aduser = Get-CsAdUser -Identity $member.Name | Where-Object {$_.enabled -ne “true”}
if($aduser -ne $())
{
Enable-CsUser -identity $aduser.identity -RegistrarPool pool name -SipAddressType emailaddress
Start-sleep -s 30
Grant-CsClientVersionPolicy -identity $aduser.identity -PolicyName “Policy name”   ##i.e Policy1
}
}

 

Advertisements
This entry was posted in Micorosft Lync. Bookmark the permalink.

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