Grant-OuPermissons Lync 2013. Powershell Script

Good Afternoon
Below is a simple script for grant the Ou-permission what are required when deploying Lync 2013 in a restricted or locked down domain/AD.

The below link reference 6 of the attributes that have to have the permissions set. Like most Clients there is never just one container level, and many clients AD drills down through many container levels. Because of this setting the grant-oupermissions would be impossible to do manually, therefore below is a little noddy script which would read an csv. file and upload the contents based on the attributes.

So to confirm to run this script you need a .csv file format of all your OU’s and subOu’s (note: the firstline is the header information)



you need to have the rows for all the object attributes required in the grant-oupermission set

User, Contact, AppContact,Computer, InetOrgPerson, Device

Now copying the below powershell into notepad, then saving it as <name.ps1>, opening it up from the lync management shell you will be presented with a option to specify the <name.csv> file. (you need to save the .csv file into the same place as you’ve save the .ps1 file.)


param( [string] $importfile = $(Read-Host -prompt `

    “Please enter the csv file name”))

$NorthernLyncArry = Import-Csv $importfile

$transcriptname = “GrantOUPermissions” + (Get-Date `

    -Format s).Replace(“:”,”-“) +”.txt”

Start-Transcript $transcriptname

foreach ($NorthernLyncArry in $NorthernLyncArry)     { Grant-CsOuPermission –ObjectType “$NorthernLyncArry.object” –ou $NorthernLyncArry.ou –Domain “northernlync.local” -Verbose             }



Add the .csv file name to the prompt and sit back and watch the updating commence.



Iain Smith


One thought on “Grant-OuPermissons Lync 2013. Powershell Script

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google 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 )

Connecting to %s