Set-CsDiagnosticConfiguration

 

Topic Last Modified: 2012-03-26

Modifies existing diagnostic configuration settings. Diagnostic configuration settings are used to determine whether traffic to or from a given domain or Uniform Resource Identifier (URI) is recorded in your Microsoft Lync Server 2010 log files.

Syntax

Set-CsDiagnosticConfiguration [-Identity <XdsIdentity>] [-Confirm [<SwitchParameter>]] [-Enabled <$true | $false>] [-Filter <Filter>] [-Force <SwitchParameter>] [-WhatIf [<SwitchParameter>]]

Set-CsDiagnosticConfiguration [-Confirm [<SwitchParameter>]] [-Enabled <$true | $false>] [-Filter <Filter>] [-Force <SwitchParameter>] [-Instance <PSObject>] [-WhatIf [<SwitchParameter>]]

Detailed Description

If you enable logging for Lync Server 2010, then, by default, traffic traveling to or from any domain or URI is included in those log files. This ensures that as much information as possible is recorded in the log files.

However, this can occasionally result in too much information. For example, if you are experiencing connectivity problems with a particular domain, you might want to limit logging to traffic between your network and that domain; that makes it easier for you to identify the relevant records and, in turn, might make it easier for you to diagnose and correct the problem.

Diagnostic configuration settings make it possible for you to specify the domains or URIs that will be recorded in the log files. Lync Server enables you to create diagnostic configuration settings at the site scope. In turn, this enables you to apply different settings to the Redmond site while than you do on your other sites.

You can use the Set-CsDiagnosticConfiguration cmdlet to add or remove filters from a given collection. Filters are used to indicate the domains whose traffic should be logged.

Who can run this cmdlet: By default, members of the following groups are authorized to run the Set-CsDiagnosticConfiguration cmdlet locally: 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 "Set-CsDiagnosticConfiguration"}

Parameters

Parameter Required Type Description

Identity

Optional

Xds Identity

Unique identifier for the diagnostics configuration settings to be modified. To modify settings configured at the site scope, use syntax similar to this: -Identity "site:Redmond". To modify the global settings, use this syntax: -Identity global.

If this parameter is not specified, then Set-CsDiagnosticConfiguration will automatically modify the global settings.

Instance

Optional

DiagnosticFilterSettings object

Allows you to pass a reference to an object to the cmdlet rather than set individual parameter values.

Filter

Optional

PS List Modifier

Collection of domains and URIs whose traffic will be logged. The Filter property consists of three separate items, and must be created using the New-CsDiagnosticsFilter cmdlet:

Fqdn – Collection of domains to be included in the filter. (More technically, the host portion of a SIP address.) For example an fully qualified domain name (FQDN) might look like this: fabrikam.com. Alternatively, you can use wildcards to represent multiple domains: *.fabrikam.com. You can include more than one domain in a single filter.

Uri – Collection of Uris to be included in the filter. (The Uri represents the user@host portion of a SIP address.) A URI can consist of any of the following patterns: user@fabrikam.com; user@*; *@fabrikam.com. You can include multiple Uris in a single filter.

Enabled – Indicates whether or not the filter should be activated.

LoggingShare

Optional

String

Shared folder where the diagnostic logs can be uploaded.

Force

Optional

Switch Parameter

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

WhatIf

Optional

Switch Parameter

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

Confirm

Optional

Switch Parameter

Prompts you for confirmation before executing the command.

Input Types

Microsoft.Rtc.Management.WritableConfig.Settings.Diagnostics.DiagnosticFilterSettings object. Set-CsDiagnosticConfiguration accepts pipelined instances of the diagnostic configuration settings object.

Return Types

Set-CsDiagnosticConfiguration does not return a value or object. Instead, the cmdlet configures instances of the Microsoft.Rtc.Management.WritableConfig.Settings.Diagnostics.DiagnosticFilterSettings object.

Example

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

$x = New-CsDiagnosticsFilter -Fqdn fabrikam.com -Uri sip:user@fabrikam.com 
Set-CsDiagnosticConfiguration -Identity global -Filter $x

The commands shown in Example 1 use New-CsDiagnosticsFilter to create a new diagnostics filter, and then assign that filter to the global diagnostic configuration settings. To carry out this task, the first command calls New-CsDiagnosticsFilter to create an in-memory-only diagnostics filterthat uses the FQDN fabrikam.com and the URI sip:user@fabrikam.com. The “virtual” filter is then stored in the variable $x.

In command 2, Set-CsDiagnosticConfiguration assigns the new filter to the global diagnostic configuration settings. In this case, any existing values in the Filter property will be replaced by the newly created filter.

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

$x = (Get-CsDiagnosticConfiguration -Identity global).Filter
$x.Fqdn.Add("fabrikam.com")
Set-CsDiagnosticConfiguration -Identity global -Filter $x

Example 2 shows how you can add a new FQDN to the Filter property of the global diagnostic configuration settings. To do this, the first command in the example uses Get-CsDiagnosticConfiguration to retrieve the value of the Filter property for the global settings. This is done by enclosing the call to Get-CsDiagnosticConfiguration in parentheses; that causes Windows PowerShell to run that command before it does anything else. After the global settings are returned, the value of the Filter property is extracted and stored in a variable named $x.

In the second command, the Add method is used to add a new FQDN (fabrikam.com) to the filter. When that’s done, the final command in the example uses Set-CsDiagnosticConfiguration to write the modified diagnostics collection. The net result is that fabrikam.com will be added to any FQDNs already included in the Filter property.

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

$x = (Get-CsDiagnosticConfiguration -Identity global).Filter
$x.Fqdn.Remove("fabrikam.com")
Set-CsDiagnosticConfiguration -Identity global -Filter $x

The commands shown in Example 3 remove an FQDN (fabrikam.com) from the Filter property global diagnostic configuration settings. The first command in the example uses Get-CsDiagnosticConfiguration to retrieve the current value of the Filter property for the global settings; this value is stored in a variable named $x. After that value has been retrieved, the Remove method is used to remove the FQDN fabrikam.com. After the FQDN has been removed, Set-CsDiagnosticConfiguration is used write the modified filter (stored in the variable $x) to the global settings.

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

Set-CsDiagnosticConfiguration -Identity global -Filter $Null

In Example 4, all the items are removed from the Filter property of the global diagnostic configuration settings. This is done by setting the Filter property to a null value.