Get-SMCounterSample

Gets performance counter samples for a particular time stamp.

Syntax

Get-SMCounterSample
   [-AsJob]
   [-BatchSize <UInt32>]
   [-CimSession <CimSession[]>]
   [-EndTime <DateTime>]
   [-StartTime <DateTime>]
   [-ThrottleLimit <Int32>]
   -CollectorName <String>
   -CounterPath <String[]>
Get-SMCounterSample
   [-AsJob]
   [-BatchSize <UInt32>]
   [-CimSession <CimSession[]>]
   [-ThrottleLimit <Int32>]
   -CollectorName <String>
   -CounterPath <String[]>
   -Timestamp <DateTime[]>

Description

The Get-SMCounterSample cmdlet gets performance counter samples for a particular time.

Examples

Example 1: Get a counter sample from a data collector set

PS C:\>Get-SMCounterSample -CollectorName "ContosoPerf" -CounterPath "C:\PerfLogs\Admin\"-EndTime 12:00 -StartTime 11:00

This command gets the performance sample for the collector named ContosoPerf and the counter path specified as C:\PerfLogs\Admin\ within a specified timeframe.

Example 2: Get a counter sample at a specified time

PS C:\>Get-SMCounterSample -CollectorName "ContosoPerf" -CounterPath "C:\PerfLogs\Admin\" -TimeStamp @(1,3,5,7)

This command gets the performance sample for the collector named ContosoPerf and the counter path named C:\PerfLogs\Admin\ at a specified time. The timestamp is an array of DateTime objects.

Parameters

-AsJob

ps_cimcommon_asjob

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-BatchSize

Specifies the batch size that the command uses to stream results.

Type:UInt32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-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-CimSessionhttp://go.microsoft.com/fwlink/p/?LinkId=227967 or Get-CimSessionhttp://go.microsoft.com/fwlink/p/?LinkId=227966 cmdlet. The default is the current session on the local computer.

Type:CimSession[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CollectorName

Specifies the name of the data collector set in Performance Log Analyzer (PLA) to query.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-CounterPath

Specifies an array of paths to the counter data.

Type:String[]
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-EndTime

Specifies the end time for the sample data collection.

Type:DateTime
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-StartTime

Specifies a start time for the sample data collection.

Type:DateTime
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

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

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Timestamp

Specifies an array of DateTime objects. The objects specify when the sampling occurs.

Type:DateTime[]
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Outputs

CimInstance[]