Get-SMCounterSample

Windows Server 2012 R2 and Windows 8.1

Get-SMCounterSample

Gets performance counter samples for a particular time or period of time.

구문

Parameter Set: InTimeRange
Get-SMCounterSample -CollectorName <String> -CounterPath <String[]> [-AsJob] [-BatchSize <UInt32> ] [-CimSession <CimSession[]> ] [-EndTime <DateTime> ] [-StartTime <DateTime> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: AtTime
Get-SMCounterSample -CollectorName <String> -CounterPath <String[]> -TimeStamp <DateTime[]> [-AsJob] [-BatchSize <UInt32> ] [-CimSession <CimSession[]> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>]




자세한 설명

The Get-SMCounterSample cmdlet gets performance counter samples for a specified time and performance counter. Before you can run this cmdlet, performance data collection must be started on the target computer; after starting performance data collection, allow 30 minutes for collection. You can start performance data collection by running the Start-SMPerformanceCollector cmdlet; you can also start performance data collection by right-clicking the row for a server that is displayed in the Performance tile of a Server Manager role or group page, and then clicking Start Performance Counters.

매개 변수

-AsJob

별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-BatchSize<UInt32>

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.


별칭

없음

필수 여부

false

위치

named

기본값

256

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-CimSession<CimSession[]>

원격 세션에서 또는 원격 컴퓨터에서 cmdlet을 실행합니다. New-CimSession 또는 Get-CimSession cmdlet의 출력과 같은 컴퓨터 이름이나 세션 개체를 입력합니다. 기본값은 로컬 컴퓨터의 현재 세션입니다.


별칭

Session

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-CollectorName<String>

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.


별칭

없음

필수 여부

true

위치

named

기본값

없음

파이프라인 입력 적용 여부

True (ByPropertyName)

와일드카드 문자 허용 여부

false

-CounterPath<String[]>

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


별칭

없음

필수 여부

true

위치

named

기본값

없음

파이프라인 입력 적용 여부

True (ByPropertyName)

와일드카드 문자 허용 여부

false

-EndTime<DateTime>

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.


별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-StartTime<DateTime>

Specifies a start time for the sample data collection. The value of this parameter is in the format System.DateTime.


별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-ThrottleLimit<Int32>

이 cmdlet을 실행하도록 설정할 수 있는 최대 동시 작업 수를 지정합니다. 이 매개 변수가 생략되거나 값 0이 입력되면 Windows PowerShell®은 컴퓨터에서 실행 중인 CIM cmdlet의 수에 따라 cmdlet에 대한 최적의 제한 한도를 계산합니다. 제한 한도는 현재 cmdlet에만 적용되며 세션이나 컴퓨터에는 적용되지 않습니다.


별칭

없음

필수 여부

false

위치

named

기본값

없음

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-TimeStamp<DateTime[]>

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


별칭

없음

필수 여부

true

위치

named

기본값

없음

파이프라인 입력 적용 여부

True (ByValue)

와일드카드 문자 허용 여부

false

<CommonParameters>

이 cmdlet은 일반 매개 변수 -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer 및 -OutVariable을 지원합니다. 자세한 내용은 다음을 참조하세요. about_CommonParameters(http://go.microsoft.com/fwlink/p/?LinkID=113216).

입력

입력 유형은 cmdlet에 파이프할 수 있는 개체의 유형입니다.

출력

출력 유형은 cmdlet이 내보내는 개체의 유형입니다.

  • Microsoft.Management.Infrastructure.CimInstance#MSFT_ServerPerformanceCounterSamples[]

예제

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.


PS C:\> Get-SMCounterSample –BatchSize 100 -EndTime (Get-Date) -StartTime (Get-Date).AddDays(-1) -CollectorName 'Server Manager Performance Monitor' -CounterPath '\Process(System)\% Processor Time'

Example 2: Get a counter sample at a specific time

This command gets performance counter samples collected at a specific time for the \Process(PowerShell)\Thread Count counter path within the Server Manager Performance Monitor collector set, running on the local server. Because no batch size is specified, a message informs you that the default batch size of 256 records is used. Note that this command returns results only if a performance counter sample was taken precisely at the specified time stamp. If the specified time stamp does not correspond to a time at which counter samples were collected, the command returns no results.


PS C:\> Get-SMCounterSample -CollectorName 'Server Manager Performance Monitor' -CounterPath '\Process(PowerShell)\Thread Count' –TimeStamp '3/19/2014 3:27:24 PM'

Example 3: Get counter samples for multiple paths, from a remote server

This command gets performance counter samples collected on a remote server for the \Memory\Available Kbytes, \Process(iexplore)\% Processor Time, and \Process(iexplore)\IO Data Bytes/sec counter paths, in the Server Manager Performance Monitor collector set. You must be a member of the Administrators group on a remote server to run this command, and the remote server must be running Windows Server 2012 or a newer release of Windows Server.

The first line creates a new CIM session targeted at a remote server, ServerManagerClient, and prompts for credentials by running (Get-Credential) as the value of the Credential parameter.

The next line of the command gets performance counter samples for Internet Explorer and available memory for the preceding 24 hours. The CIM session variable from the first line of the command is applied to get the samples from the remote server, ServerManagerClient.


PS C:\> $RemoteSession = New-CimSession –ComputerName ServerManagerClient –Credential (Get-Credential)
PS C:\>Get-SMCounterSample –BatchSize 200 –CimSession $RemoteSession –CounterPath @('\Memory\Available Kbytes','\Process(iexplore)\% Processor Time','\Process(iexplore)\IO Data Bytes/sec') –CollectorName 'Server Manager Performance Monitor' –EndTime (Get-Date)–StartTime (Get-Date).AddDays(-1)

커뮤니티 추가 항목

추가
표시: