We use cookies to improve your experience.
By your continued use of this site you accept such use.
For more details please see our privacy policy and cookies policy.

Script Repository

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

February 22, 2021 Views: 1930

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
Leave a comment
Loading...

Got questions?

Support Questions & Answers