Edit

Share via


Invoke-CsArchivingDatabasePurge

Manually purges records from the Archiving database. This cmdlet was introduced in Lync Server 2013.

Syntax

Identity

Invoke-CsArchivingDatabasePurge
    [-Identity] <XdsIdentity>
    [-PurgeArchivingDataOlderThanHours] <Int32>
    [-PurgeExportedArchivesOnly] <Boolean>
    [[-MaxArchivingRecordsToDelete] <Int32>]
    [-Confirm]
    [-Force]
    [-WhatIf]
    [<CommonParameters>]

SqlServer

Invoke-CsArchivingDatabasePurge
    [-PurgeArchivingDataOlderThanHours] <Int32>
    [-PurgeExportedArchivesOnly] <Boolean>
    [[-MaxArchivingRecordsToDelete] <Int32>]
    -SqlServerFqdn <String>
    [-Confirm]
    [-Force]
    [-SqlInstanceName <String>]
    [-WhatIf]
    [<CommonParameters>]

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 Skype for Business 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, Skype for Business Server provides two ways for administrators to purge older records from the database: 1) you can configure Skype for Business 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.

Skype for Business Server Control Panel: The functions carried out by the Invoke-CsArchivingDatabasePurge cmdlet are not available in the Skype for Business Server Control Panel.

Examples

Example 1


Invoke-CsArchivingDatabasePurge -Identity "service:ArchivingDatabase:atl-sql-001.litwareinc.com" -PurgeArchivingDataOlderThanHours 24 -PurgeExportedArchivesOnly $False

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).

Example 2


Invoke-CsArchivingDatabasePurge -Identity "service:ArchivingDatabase:atl-sql-001.litwareinc.com" -PurgeArchivingDataOlderThanHours 24 -PurgeExportedArchivesOnly $False -Confirm:$False

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.

Example 3


Get-CsService -ArchivingDatabase | ForEach-Object {Invoke-CsArchivingDatabasePurge -Identity $_.Identity -PurgeArchivingDataOlderThanHours 24 -PurgeExportedArchivesOnly $False -Confirm:$False}

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.

Parameters

-Confirm

Applicable: Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

Prompts you for confirmation before executing the command.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

Applicable: Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

Suppresses the display of any non-fatal error message that might occur when running the command.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Identity

Applicable: Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

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.

Parameter properties

Type:XdsIdentity
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Identity
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-MaxArchivingRecordsToDelete

Applicable: Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

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.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:4
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PurgeArchivingDataOlderThanHours

Applicable: Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

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.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PurgeExportedArchivesOnly

Applicable: Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

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.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SqlInstanceName

Applicable: Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

SQL Server instance name for the archiving database. For example:

-SqlInstanceName "archinst"

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SqlServer
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SqlServerFqdn

Applicable: Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

SqlServer
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Applicable: Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

Describes what would happen if you executed the command without actually executing the command.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

Microsoft.Rtc.Management.Xds.DisplayArchivingDatabase

The Invoke-CsArchivingDatabasePurge cmdlet accepts pipelined instances of the Microsoft.Rtc.Management.Xds.DisplayArchivingDatabase#Decorated class.

Outputs

Microsoft.Rtc.Management.Purge.ArchDataPurgeStatistics

The Invoke-CsArchivingDatabasePurge cmdlet returns instances of the Microsoft.Rtc.Management.Purge.ArchDataPurgeStatistics class.