Topic Last Modified: 2013-02-20
Manually purges records from the Archiving database. This cmdlet was introduced in Lync Server 2013.
Syntax
Invoke-CsArchivingDatabasePurge -Identity
<XdsIdentity> <COMMON PARAMETERS>
|
Invoke-CsArchivingDatabasePurge -SqlServerFqdn
<String> [-SqlInstanceName <String>] <COMMON
PARAMETERS>
|
COMMON PARAMETERS: -PurgeArchivingDataOlderThanHours
<Int32> -PurgeExportedArchivesOnly <$true | $false>
[-Confirm [<SwitchParameter>]] [-Force
<SwitchParameter>] [-MaxArchivingRecordsToDelete
<Int32>] [-WhatIf [<SwitchParameter>]]
|
Examples
Example 1
The command shown in Example 1 purges all the records more than 24 hours old from the archiving database on atl-sql-001.litwareinc.com. To ensure that all the records are deleted, including records that have not been exported, the PurgeExportedArchivesOnly parameter is set to False ($False).
Copy Code | |
---|---|
Invoke-CsArchivingDatabasePurge -Identity "service:ArchivingDatabase:atl-sql-001.litwareinc.com" -PurgeArchivingDataOlderThanHours 24 -PurgeExportedArchivesOnly $False |
Example 2
The command shown in Example 2 is a variation of the command shown in Example 1; in this case, however, the Confirm parameter is added using this syntax:
-Confirm:$False
That syntax suppresses the confirmation prompts that would otherwise appear when purging archiving records.
Copy Code | |
---|---|
Invoke-CsArchivingDatabasePurge -Identity "service:ArchivingDatabase:atl-sql-001.litwareinc.com" -PurgeArchivingDataOlderThanHours 24 -PurgeExportedArchivesOnly $False -Confirm:$False |
Example 3
Example 3 purges all the records more than 24 hours old from all the Archiving databases in use in the organization. To do this, the first command in the example uses the Get-CsService cmdlet and the ArchivingDatabase parameter to return a collection of all the archiving databases. This collection is then piped to the ForEach-Object cmdlet. In turn, the ForEach-Object cmdlet takes each database in the collection and then runs the Invoke-CsArchivingDatabasePurge cmdlet against that database, purging all the records more than 24 hours old.
Copy Code | |
---|---|
Get-CsService -ArchivingDatabase | ForEach-Object {Invoke-CsArchivingDatabasePurge -Identity $_.Identity -PurgeArchivingDataOlderThanHours 24 -PurgeExportedArchivesOnly $False -Confirm:$False} |
Detailed Description
Many organizations find it useful to keep a transcript of all the IM sessions carried out by their users (or a selected subset of users). For other organizations, it’s mandatory to keep such transcripts. For example, many organizations in the financial world are required by law to keep copies of all their electronic communications.
If you have enabled archiving in your organization and if you have chosen to use Lync Server as your archiving backend, then your archiving records will be stored in the SQL Server database LcsLog. (Alternatively, archiving records can be stored using Microsoft Exchange instead. See the help topic for the New-CsArchivingConfiguration cmdlet for more information.) Over time, the archiving database has the potential to grow extremely large. Because of that, Lync Server provides two ways for administrators to purge older records from the database: 1) you can configure Lync Server to automatically delete older archiving records each day; and/or, 2) you can use the Invoke-CsArchivingDatabasePurge cmdlet at any time to delete archiving records from the LcsLog database. (The Invoke-CsArchivingDatabasePurge cmdlet does this by calling the SQL Server stored procedures RtcCleanupTempConference and RtcCleanupDB as well as deleted stored meeting content.)
When you call the Invoke-CsArchivingDatabasePurge cmdlet you must specify the service location of the archiving database where the archiving records are stored (for example, ArchivingDatabase:atl-sql-001.litwareinc.com); you must also indicate the minimum age (in hours) of the archiving records to be deleted. For example, if you specify a minimum age of 24 hours then all archiving records older than 24 hours will be deleted from the database.
Note that these records will be deleted even if the purging has been disabled for the specified database. (That is, the EnablePurging property in the archiving configuration settings has been set to False.) The EnablePurging property only controls the automated purging of archiving records; it has no effect on the Invoke-CsArchivingDatabasePurge cmdlet.
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 command-line interface prompt:
Get-CsAdminRole | Where-Object {$_.Cmdlets –match "Invoke-CsArchivingDatabasePurge"}
Lync Server Control Panel: The functions carried out by the Invoke-CsArchivingDatabasePurge cmdlet are not available in the Lync Server Control Panel.
Parameters
Parameter | Required | Type | Description |
---|---|---|---|
Identity |
Required |
Microsoft.Rtc.Management.Xds.XdsIdentity |
Service Identity of the archiving database to be purged. You can retrieve the Identities for your archiving databases by running this command: Get-CsService –ArchivingDatabase Note that you cannot use the Identity parameter and the SqlServerFqdn parameter in the same command. |
PurgeArchivingDataOlderThanHours |
Required |
System.Int32 |
Specifies the age (in hours) of the archiving records to be purged from the database; any records older than this value will be deleted. PurgeArchivingDataOlderThanHours can be set to any integer value between 1 and 2147483647, inclusive. |
PurgeExportedArchivesOnly |
Required |
System.Boolean |
When present, records will be removed for the archiving database only if those records have been exported (and, as a result, have been marked for deletion). Records that have not been exported will remain in the database, even if those records are older than the value specified by the PurgeArchivingDataOlderThanHours property. |
SqlServerFqdn |
Required |
System.String |
Fully qualified domain name of the computer where the archiving database is located. For example: -SqlServerFqdn "atl-sql-001.litwareinc.com" Note that you cannot use the Identity parameter and the SqlServerFqdn parameter in the same command. |
Confirm |
Optional |
System.Management.Automation.SwitchParameter |
Prompts you for confirmation before executing the command. |
Force |
Optional |
System.Management.Automation.SwitchParameter |
Suppresses the display of any non-fatal error message that might occur when running the command. |
MaxArchivingRecordsToDelete |
Optional |
System.Int32 |
Specifies the maximum number of archiving records to be purged from the database; if you set this value to 99 and you have 100 records in the database that meet the PurgeArchivingDataOlderThanHours criterion, only the 99 oldest records will be deleted. MaxArchivingRecordsToDelete can be set to any integer value between 1 and 2147483647, inclusive. |
SqlInstanceName |
Optional |
System.String |
SQL Server instance name for the archiving database. For example: -SqlInstanceName "archinst" |
WhatIf |
Optional |
System.Management.Automation.SwitchParameter |
Describes what would happen if you executed the command without actually executing the command. |
Input Types
The Invoke-CsArchivingDatabasePurge cmdlet accepts pipelined instances of the Microsoft.Rtc.Management.Xds.DisplayArchivingDatabase#Decorated class.
Return Types
The Invoke-CsArchivingDatabasePurge cmdlet returns instances of the Microsoft.Rtc.Management.Purge.ArchDataPurgeStatistics class.