The script can be used in business rules, custom commands or scheduled tasks to assign a Lync Conferencing Policy to an AD user. For example, to assign a policy to new users, you need to create a business rule triggered automatically once a new user is created. For more information on how to automatically run a script once a new user is created, see Run PowerShell Script after Creating a User.
Parameters:
- $lyncServer - Specifies the fully qualified domain name (FQDN) of the Lync Server where the operation must be performed.
- $policyName - Specifies the name of the Conferencing Policy to assign.
Note: To be able to assign a policy, the user account that is used to run the script must be assigned to the CsUserAdministrator role or the CsAdministrator role in Lync.
PowerShell
$lyncServer = "lyncserver.domain.com" # TODO: Modify me
$policyName = "SalesConferencingPolicy"
$sessionOptions = New-PSSessionOption -SkipRevocationCheck -SkipCACheck -SkipCNCheck
$session = New-PSSession -ConnectionUri https://$lyncServer/ocspowershell `
-SessionOption $sessionOptions -Authentication NegotiateWithImplicitCredential
Import-PSSession -session $session
Grant-CsConferencingPolicy -identity "%userPrincipalName%" -PolicyName $policyName
Remove-PSSession -Session $session