Hello,
Currently, Adaxes ADSI API doesn't support assigning Lync Policies, however you can still use your script. To execute the script automatically as a part of the user provisioning process, you need to add the script to the Business Rule that you use for provisioning users. For this purpose, you need to use the Run a program or PowerShell script action that executes the script.
For information on how to add an action to a Business Rule, see Modifying Business Rule Actions And Conditions.
In your script, you need to create a remote session to your Lync Server before you can call Lync management cmdlets, for example:
$lyncServer = "lyncserver.domain.com" # TODO: Modify me
$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 MyConferencingPolicy # Assign a Conferencing Policy
Grant-CsPinPolicy -Identity "%userPrincipalName%" -PolicyName MyPinPolicy # Assign a PIN Policy
Grant-CsExternalAccessPolicy -Identity "%userPrincipalName%" -PolicyName MyAccessPolicy # Assign an External Access Policy
Grant-CsArchivingPolicy -Identity "%userPrincipalName%" -PolicyName MyArchivingPolicy # Assign an Archiving Policy
Grant-CsMobilityPolicy -Identity "%userPrincipalName%" -PolicyName MyMobilityPolicy # Assign a Mobility Policy
Grant-CsPersistentChatPolicy -Identity "%userPrincipalName%" -PolicyName MyPersistentChatPolicy # Assign a Persistent Chat Policy
Remove-PSSession -Session $session
In the script, $lyncServer specifies the fully qualified domain name (FQDN) of your Lync Server.
If you need more help with adapting your script to use with a Business Rule, do not hesitate to ask.