Gets performance counter samples for a particular time or period of time.
Windows Server · Risk: Low · Documentation Verified
Last verified: 2026-10-26
Microsoft ServerManagerTasks reference: Gets performance counter samples for a particular time or period of time. The syntax and selected example below are adapted from the pinned Windows Server 2025 reference. Module availability, target configuration and delegated permissions determine whether it can run in your environment. Documentation and parameter text: Microsoft, CC BY 4.0; formatting adapted by Cmdlet World. No execution testing is claimed.
Use an account with the target resource permissions documented for Get-SMCounterSample. Modifying administrative cmdlets may require elevation or delegated administration. This catalog does not assert that ordinary users can execute the command.
Supported environments
Windows / ServerManagerTasks · Windows Server 2025 documentation; feature/module prerequisites apply
Parameters
-AsJob
Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.
-BatchSize
Specifies the batch size of results; in this case, the number of performance counter samples returned. If you do not specify a batch size, the default value is 256.
-CimSession
Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.
-CollectorName (required)
Specifies the name of the data collector set in Performance Log Analyzer (PLA) to query. The collector name for Server Manager is 'Server Manager Performance Monitor'; because this name contains spaces, it must be specified in your command in quotations, as shown here. If desired, you can create a custom data collector set in Performance Logs and Alerts (PLA). For more information about how to create a custom data collector set, see Creating a Collector Set and Create a Data Collector Set Manually.
-CounterPath (required)
Specifies an array of paths to the counter data. The following are valid values for the counter path, within the Server Manager Performance Monitor. To return performance counter samples for all processes, keep the asterisk (*) in the value; to return samples for a specific process, replace the asterisk with a process name, such as System. To get performance counter samples for multiple paths, specify an array as a value for this parameter, placing quotations around paths, and separating paths with commas, as shown in the following example: @(' Process(*)\% Processor Time','\Memory\Available KBytes'). \Processor(_Total)\% Processor Time \Memory\Available KBytes \Process(*)\% Processor Time \Process(*)\IO Data Bytes/sec \Process(*)\Private Bytes \Process(*)\Thread Count \Process(*)\ID Process
-EndTime
Specifies the end time for the sample data collection. The value of this parameter is in the format System.DateTime. A simple way of providing an end time that is the same as the current time is to specify (Get-Date) as the value of the parameter.
-StartTime
Specifies a start time for the sample data collection. The value of this parameter is in the format System.DateTime.
-ThrottleLimit
Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.
Prerequisites
Windows with the ServerManagerTasks module and the Windows feature or management tools that provide it. Confirm target connectivity and version compatibility using the linked Microsoft reference.
Security considerations
This is a read-oriented cmdlet; protect any sensitive results and check the documented effects of your selected parameters.
Examples
Example 1: Get counter samples from the preceding 24 hours
This command gets performance counter samples for the \Process(System)\% Processor Time counter path within the Server Manager Performance Monitor collector set, running on the local server. The start time is set to 24 hours before the current time, and the end time is set to the current time. The batch size is set to 100 records. Source: Microsoft, CC BY 4.0; transcript prompt/output removed. This example was not executed.