Script Repository


Use property of user accounts to store names of assigned Conferencing Policies

January 19, 2016
1092

The script gets the Conferencing Policy assigned to a user in Lync and saves it to a property of the user account. This can be used to quickly view which policies are assigned to which users.

To automatically update user accounts with Conferencing Policies assigned to them, you can create a Scheduled Task that runs the script on a regular basis. To run a script as a part of a Scheduled Task, use the Run a program or PowerShell script action.

Parameters:

  • $lyncServer - specifies the fully qualified domain name (FQDN) of your Lync Server;
  • $propertyName - specifies the LDAP display name of the property that will be used to store the Conferencing Policy name.
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.
Edit Remove
PowerShell
$lyncServer = "lyncserver.domain.com" # TODO: modify me
$propertyName = "adm-CustomAttributeText1" # TODO: modify me

try
{
    # Connect to the Lync Server
    $sessionOptions = New-PSSessionOption -SkipRevocationCheck -SkipCACheck -SkipCNCheck
    $session = New-PSSession -ConnectionUri https://$lyncServer/ocspowershell `
        -SessionOption $sessionOptions -Authentication NegotiateWithImplicitCredential

    Import-PSSession -session $session
    
    # Get the Conferencing Policy
    $conferencingPolicy = (Get-CsUser -Identity "%userPrincipalName%").ConferencingPolicy
    
    # Update the attribute
    $Context.TargetObject.Put($propertyName, $conferencingPolicy)
    $Context.TargetObject.SetInfo()
}
finally
{
    # Close the remote session and release resources
    Remove-PSSession -Session $session
}


Comments ( 0 )
No results found.
Leave a comment