Topic Last Modified: 2012-03-23

Returns information about your instant messaging (IM) session archiving policies. Archiving policies enable you to archive all IM and web conferencing sessions that take place between internal users and/or between internal users and external users.

Get-CsArchivingPolicy [-Identity <XdsIdentity>] [-LocalStore <SwitchParameter>]
Get-CsArchivingPolicy [-Filter <String>] [-LocalStore <SwitchParameter>]

Many organizations find it useful to keep an archive of all the IM sessions that their users take part in; other organizations are legally required to keep such an archive. In order to archive IM sessions with Microsoft Lync Server 2010, you must perform two steps. First, you need to enable archiving at the global and/or the site scope by using the Set-CsArchivingConfiguration cmdlet. This gives you the ability to archive IM sessions; however, it does not automatically begin archiving those sessions.

Instead, to actually save transcripts of your IM sessions you must complete step 2: create one or more IM session archiving policies. These policies determine which users will have their IM sessions recorded and which type of IM sessions (internal and/or external) will be archived. Internal IM sessions are sessions where all of the participants are authenticated users who have Active Directory accounts within your organization; external IM sessions are sessions where at least one participant is an unauthenticated user who does not have an Active Directory account within your organization. You can choose to archive only internal sessions, only external sessions, or both internal and external sessions.

Archiving policies (which are created with the New-CsArchivingPolicy cmdlet) can be assigned to the global site or to the site scope. In addition, these policies can be assigned to the per-user scope; this means that a policy can be created and then applied to a specific user or a specific set of users. For example, you might have a global policy that archives internal IM sessions for all your users. In addition, you might create a second policy, one that archives both internal and external sessions, and apply that policy to your sales staff. Because per-user policies take precedence over global and site policies, members of the sales staff will have all their IM sessions archived. Other users (users who are not part of the sales department and are not affected by the sales policy) will have only their internal IM sessions archived.

The Get-CsArchivingPolicy cmdlet provides a way for you to return information about the archiving policies that have been configured for use in your organization. Keep in mind that these policies are enforced only if IM session archiving has been enabled at the global or site scope. To determine whether or not IM session archiving has been enabled, use the Get-CsArchivingConfiguration cmdlet.

Who can run this cmdlet: By default, members of the following groups are authorized to run the Get-CsArchivingPolicy cmdlet locally: RTCUniversalUserAdmins, RTCUniversalServerAdmins. To return a list of all the role-based access control (RBAC) roles this cmdlet has been assigned to (including any custom RBAC roles you have created yourself), run the following command from the Windows PowerShell prompt:

Get-CsAdminRole | Where-Object {$_.Cmdlets –match "Get-CsArchivingPolicy"}


Parameter Required Type Description



Xds Identity

Unique identifier of the archiving policy to be returned. To refer to the global policy, use this syntax: -Identity global. To refer to a site policy, use syntax similar to this: -Identity site:Redmond. To refer to a per-user policy, use syntax similar to this: -Identity RedmondArchivingPolicy. If this parameter is omitted, then all of the archiving policies configured for use in your organization will be returned.




Enables you to use wildcard characters when indicating the policy (or policies) to be returned. For example, to return all of the policies configured at the site scope, use this syntax: -Filter "site:*". This returns any policy where the Identity (the only property you can filter on) begins with the string value "site:". To return a collection of all the per-user policies that have an Identity that begins with "Sales", use this syntax: -Filter "Sales*".



Switch Parameter

Retrieves the archiving policy data from the local replica of the Central Management store rather than from the Central Management store itself.

None. Get-CsArchivingPolicy does not accept pipelined input.

Get-CsArchivingPolicy returns instances of the Microsoft.Rtc.Management.WritableConfig.Policy.Im.IMArchivingPolicy object.

-------------------------- Example 1 --------------------------


Example 1 calls Get-CsArchivingPolicy without any parameters. This returns a collection of all the archiving policies currently in use in your organization.

-------------------------- Example 2 --------------------------

Get-CsArchivingPolicy -Identity site:Redmond

In Example 2, Get-CsArchivingPolicy is used to return the archiving policy with the Identity site:Redmond. Because identities must be unique, this command will always return, at most, a single policy.

-------------------------- Example 3 --------------------------

Get-CsArchivingPolicy -Filter tag:*

The preceding command returns a collection of all the archiving policies that have been configured at the per-user scope. This is done by including the Filter parameter and the filter value "tag:*". That filter value instructs Get-CsArchivingPolicy to return only those policies that have an identity beginning with the string value "tag:".

-------------------------- Example 4 --------------------------

Get-CsArchivingPolicy | Where-Object {$_.ArchiveInternal -eq $False}

Example 4 returns a collection of all the archiving policies where the archiving of internal IM sessions has been disabled. To do this, Get-CsArchivingPolicy is first used to return a collection of all the archiving policies currently in use. That collection is then piped to the Where-Object cmdlet. In turn, Where-Object applies a filter that restricts the returned data to those policies where the ArchiveInternal property is equal to False.

-------------------------- Example 5 --------------------------

Get-CsArchivingPolicy | Where-Object {$_.ArchiveInternal -eq $False -and $_.ArchiveExternal -eq $False}

Example 5 is similar to Example 4; in this case, however, the command returns all of the archiving policies where both internal and external archiving are disabled. To accomplish this, Get-CsArchivingPolicy is first used to return a collection of all the archiving policies currently in use. That collection is then piped to Where-Object, which picks out only those policies where both the ArchiveInternal and the ArchiveExternal properties are equal to False. The -and operator instructs Where-Object to only select policies that meet all the specified criteria. To select policies that meet just one (or both) of the specified criteria use the –or operator:

Where-Object {$_.ArchiveInternal -eq $False -or $_.ArchiveExternal -eq $False}