Export (0) Print
Expand All

Add-SPDiagnosticsPerformanceCounter

 

Applies to: SharePoint Server 2010, SharePoint Foundation 2010

Topic Last Modified: 2010-05-07

Adds a new instance of a performance counter to a Web front end computer or a database server.

Add-SPDiagnosticsPerformanceCounter [-Category] <String> -Counter <String> [-AllInstances <SwitchParameter>] [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-DatabaseServer <SwitchParameter>] [-WebFrontEnd <SwitchParameter>] [-WhatIf [<SwitchParameter>]]
Add-SPDiagnosticsPerformanceCounter [-Category] <String> -Instance <String> [-AllInstances <SwitchParameter>] [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-Counter <String>] [-DatabaseServer <SwitchParameter>] [-WebFrontEnd <SwitchParameter>] [-WhatIf [<SwitchParameter>]]

This cmdlet contains more than one parameter set. You may only use parameters from one parameter set, and you may not combine parameters from different parameter sets. For more information about how to use parameter sets, see Cmdlet Parameter Sets.

The Add-SPDiagnosticsPerformanceCounter cmdlet adds a performance counter to a front end Web server or a database server. A performance counter is read and recorded in the usage database. By default, the new performance counter is added to the database servers in the farm.

 

Parameter Required Type Description

Category

Required

System.String

Specifies the category of performance counter to add to the target Web front end computer or database server.

The type must be a valid name of a category of performance counters; for example, ASP.NET, PhysicalDisk, or Processor.

Counter

Required

System.String

Specifies the type of counter to add to the target Web front end computer or database server.

The type must be a valid name of counter type; for example, Requests Queued, Avg. Disk Queue Length, and % Processor Time.

Instance

Required

System.String

Specifies the display name of the new performance counter.

The type must be a valid name of a performance counter instance; for example Total_PerfCounter.

AllInstances

Optional

System.Management.Automation.SwitchParameter

Collects all instances of a counter category and type on the target Web front end computer or database server.

AssignmentCollection

Optional

Microsoft.SharePoint.PowerShell.SPAssignmentCollection

Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.

noteNote
When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.

Confirm

Optional

System.Management.Automation.SwitchParameter

Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters

DatabaseServer

Optional

System.Management.Automation.SwitchParameter

Adds the specified performance counter to all database servers in the farm.

WebFrontEnd

Optional

System.Management.Automation.SwitchParameter

Adds the specified performance counter to all Web front end computers in the farm.

WhatIf

Optional

System.Management.Automation.SwitchParameter

Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters

------------------EXAMPLE 1------------------

Add-SPDiagnosticsPerformanceCounter -category ASP.NET -Counter "Requests Queued"

This example adds the counter that has the name ASP.NET\Requests Queued on front end Web servers.

------------------EXAMPLE 2------------------

Add-SPDiagnosticsPerformanceCounter -category PhysicalDisk -counter "Avg. Disk Queue Length" -allinstances

This example adds all instances of the counter PhysicalDisk in the category Avg. Disk Queue Length on front end Web servers.

------------------EXAMPLE 3------------------

Add-SPDiagnosticsPerformanceCounter -category Processor -counter "% Processor Time" -instance "_Total" -databaseserver

This example adds the _Total instance of the counter % Processor Time in the category Processor on database servers.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft