Tuesday 31 December 2013

How to assign multiple lync policies to bulk users

In order to assign multiple lync policies to bulk users, you can use lync power shell to achieve the same.

Prepare a text file with the user display names as shown below:

User1
User2
User3

Lets give the text file name as Users.txt

For eg. if you need to assign Conferencing Policy, Client Policy and External Access Policy to bulk users then you can run the below command

Open Lync Powershell

Get-Content -Path C:\Users.txt | Grant-CsConferencingPolicy -PolicyName "Conf" | Grant-CsClientPolicy -PolicyName "Client" | Grant-CsExternalAccessPolicy -PolicyName "External"

To view the assigned policies for the users, run the below command

Get-Content -Path C:\Users.txt | Get-CsUser | Select-Object SamAccountName, ConferencingPolicy, ClientPolicy, ExternalAccessPolicy | ft -wrap -autosize

Output will be like below:

SamAccountName ConferencingPolicy ClientPolicy        ExternalAccessPolicy
User1                  Conf                       Client                      External
User2                  Conf                       Client                      External
User3                  Conf                       Client                      External

2 comments:

  1. I have tried different ways to user the SAMAcountName, DiplayName, Etc and all I get back is:

    Grant-CsClientPolicy : Management object not found for identity

    ReplyDelete
  2. Hi Anil,

    I tried the command but it never worked :)
    Only one policy assigned not all 3 :(

    ReplyDelete