Get Lync Online 2013 Policies Via PowerShell

Lync Online 2013 lets you grant policies to individual users.  You cannot add your own policies, change the existing ones, or update the global policy. You can view the polices that exist and choose one of them to apply to users. As of today, there are three policies in addition to the global policy: ClientPolicyNoSaveIMNoArchivingNoIMURL, ClientPolicyNoIMURL, ClientPolicyNoSaveIMNoArchiving These policies deal with the ability to archive messages, and the ability to send clickable links via chat.  No other policy parameters are changed by applying the existing policies.

Policy Name DisableSavingIM EnableCallLogAutoArchiving EnableIMAutoArchiving EnableURL
Global blank blank blank blank
ClientPolicyNoSaveIMNoArchivingNoIMURL TRUE FALSE FALSE FALSE
ClientPolicyNoIMURL FALSE TRUE TRUE FALSE
ClientPolicyNoSaveIMNoArchiving TRUE FALSE FALSE TRUE

DisableSavingIM: When TRUE, it prevents Lync from saving instant messages.
EnableCallLogAutoArchiving: When TRUE, it will save your call log in Outlook’s Conversation History folder
EnableIMAutoArchiving: When TRUE, it will save your IM conversations in Outlook’s Conversation History folder
EnableURL: When TRUE, links in your Lync chat sessions will become clickable

Before you can connect to Lync Online, you need to download the Windows PowerShell Module for Lync Online.  As of today, it is located here:
http://www.microsoft.com/en-us/download/details.aspx?id=39366

Once you have the Lync Module installed in your PowerShell, connect to Lync online by executing these commands in your PowerShell or PowerShell ISE window.  When prompted, you will need to enter your Office 365 administrator account credentials.

Import-Module LyncOnlineConnector
$cred = Get-Credential
$CsSession = New-CsOnlineSession -Credential $cred
Import-PSSession $CsSession -AllowClobber

Once you are authenticated, you can manage Lync Online.

To get all the policies, run:
Get-CsClientPolicy

To see an individual policy, run:
Get-CsClientPolicy -Identity PolicyName

For example:
Get-CsClientPolicy -Identity ClientPolicyNoSaveIMNoArchivingNoIMURL

You can export them to a .csv file in your my documents folder, then view them in Excel:
$filepath = [environment]::getfolderpath("mydocuments") + "\lyncsettings.csv"
Get-CsClientPolicy | export-csv $filepath -NoTypeInformation

You can apply the policy to a single user by using the grant-cspolicy command. If you want to apply the ClientPolicyNoSaveIMNoArchivingNoIMURL policy to a single user, execute this command:
Grant-CsClientPolicy -Identity username -PolicyName "ClientPolicyNoSaveIMNoArchivingNoIMURL"

You can apply the policy to multiple users by using the get-csuser command. For example, to apply the ClientPolicyNoSaveIMNoArchiving to all supervisors, execute this command:
Get-CsUser -LDAPFilter "Title=Supervisor" | Grant-CsClientPolicy -PolicyName "ClientPolicyNoSaveIMNoArchiving"

Once your remote session is complete, you should remove it.

Remove-PSSession $CsSession

Comments are closed.