Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Invoke-CsCdrDatabasePurge

Lync Server 2013
 

Topic Last Modified: 2013-03-06

Manually purges records from the Call Detail records (CDR) database. This cmdlet was introduced in Lync Server 2013.

Invoke-CsCdrDatabasePurge -Identity <XdsIdentity> <COMMON PARAMETERS>
Invoke-CsCdrDatabasePurge -SqlServerFqdn <String> [-SqlInstanceName <String>] <COMMON PARAMETERS>
COMMON PARAMETERS: -PurgeCallDetailDataOlderThanDays <Int32> -PurgeDiagnosticDataOlderThanDays <Int32> [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-WhatIf [<SwitchParameter>]]

The command shown in Example 1 deletes all the records (both call detail and diagnostic records) from the monitoring database atl-sql-001.litwareinc.com that are more than 10 days old.

Invoke-CsCdrDatabasePurge -Identity "service:MonitoringDatabase:atl-sql-001.litwareinc.com" -PurgeCallDetailDataOlderThanDays 10 -PurgeDiagnosticDataOlderThanDays 10

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 CDR records.

Invoke-CsCdrDatabasePurge -Identity "service:MonitoringDatabase:atl-sql-001.litwareinc.com" -PurgeCallDetailDataOlderThanDays 10 -PurgeDiagnosticDataOlderThanDays 10 -Confirm:$False

Example 3 purges all the records more than 10 days old from all the CDR databases in use in the organization. To do this, the first command in the example uses the Get-CsService cmdlet and the MonitoringDatabase parameter to return a collection of all the monitoring 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-CsCdrDatabasePurge cmdlet against that database, purging all the call detail records more than 10 days old.

Get-CsService -MonitoringDatabase | ForEach-Object {Invoke-CsCdrDatabasePurge -Identity $_.Identity -PurgeCallDetailDataOlderThanDays 10 -PurgeDiagnosticDataOlderThanDays 10 -Confirm:$False}

Call detail recording (CDR) provides a way for you to track usage of Lync Server capabilities such as Voice over IP (VoIP) phone calls; instant messaging (IM); file transfers; audio/video (A/V) conferencing; and application sharing sessions. CDR keeps usage information: it logs information such as the parties involved in the call; the length of the call; and whether or not any files were transferred. However, CDR does not make a recording of the call itself.

CDR also keeps track of call error information: detailed diagnostic data for both peer-to-peer sessions and for conferencing calls.

Call detail records are stored in the SQL Server database LcsCDR. Over time, this 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 CDR records each day; and/or, 2) you can use the Invoke-CsCdrDatabasePurge cmdlet at any time to delete CDR records from the LcsCDR database. (The Invoke-CsCdrDatabasePurge cmdlet does this by calling the SQL Server stored procedure RtcCleanupDB.)

When you call the Invoke-CsCdrDatabasePurge cmdlet you must specify the service location of the monitoring database where the CDR records are stored (for example, MonitoringDatabase:atl-sql-001.litwareinc.com); you must also indicate the minimum age (in days) of the call detail and diagnostic data records to be deleted. For example, if you specify a minimum age of 10 days for call detail records, then all call detail records older than 10 days 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 CDR configuration settings has been set to False.) The EnablePurging property only controls the automated purging of CDR records; it has no effect on the Invoke-CsCdrDatabasePurge 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-CsCdrDatabasePurge"}

Lync Server Control Panel: The functions carried out by the Invoke-CsCdrDatabasePurge cmdlet are not available in the Lync Server Control Panel.

 

Parameter Required Type Description

Identity

Required

Microsoft.Rtc.Management.Xds.XdsIdentity

Service Identity of the monitoring database to be purged. You can retrieve the Identities for your monitoring databases by running this command:

Get-CsService –MonitoringDatabase

Note that you cannot use the Identity parameter and the SqlServerFqdn parameter in the same command.

PurgeCallDetailDataOlderThanDays

Required

System.Int32

Specifies the age (in days) of the call detail records to be purged from the database; any records older than this value will be deleted. Call detail records represent user/session reports. They differ from diagnostic data reports, which are diagnostic logs uploaded by client applications such as Lync 2013.

PurgeCallDetailDataOlderThanDays can be set to any integer value between 1 and 2147483647, inclusive.

PurgeDiagnosticDataOlderThanDays

Required

System.Int32

Specifies the age (in days) of the diagnostic data records to be purged from the database; any records older than this value will be deleted. Diagnostic data reports are diagnostic logs uploaded by client applications such as Lync 2013.

PurgeDiagnosticDataOlderThanHours can be set to any integer value between 1 and 2147483647, inclusive.

SqlServerFqdn

Required

System.String

Fully qualified domain name of the computer where the CDR 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.

SqlInstanceName

Optional

System.String

SQL Server instance name for the CDR 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.

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

The Invoke-CsCdrDatabasePurge cmdlet returns instances of the Microsoft.Rtc.Management.Purge.CdrDataPurgeStatistics class.

 
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.