commands

^

Get-DbaPfDataCollectorCounterSample

Author Chrissy LeMaire (@cl), netnerds.net
Availability Windows only

 

Synopsis

Gets Performance Counter Samples.

Description

Gets Performance Counter Samples.

Syntax

Get-DbaPfDataCollectorCounterSample
    [[-ComputerName] <DbaInstanceParameter[]>]
    [[-Credential] <PSCredential>]
    [[-CollectorSet] <String[]>]
    [[-Collector] <String[]>]
    [[-Counter] <String[]>]
    [-Continuous]
    [[-ListSet]]
    [[-MaxSamples] <Int32>]
    [[-SampleInterval] <Int32>]
    [[-InputObject] <Object[]>]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Get-DbaPfDataCollectorCounterSample

Gets a single sample for all counters for all Collector Sets on localhost.

Example: 2
PS C:\> Get-DbaPfDataCollectorCounterSample -Counter '\Processor(_Total)\% Processor Time'

Gets a single sample for all counters for all Collector Sets on localhost.

Example: 3
PS C:\> Get-DbaPfDataCollectorCounter -ComputerName sql2017, sql2016 | Out-GridView -PassThru | Get-DbaPfDataCollectorCounterSample -MaxSamples 10

Gets 10 samples for all counters for all Collector Sets for servers sql2016 and sql2017.

Example: 4
PS C:\> Get-DbaPfDataCollectorCounterSample -ComputerName sql2017

Gets a single sample for all counters for all Collector Sets on sql2017.

Example: 5
PS C:\> Get-DbaPfDataCollectorCounterSample -ComputerName sql2017, sql2016 -Credential ad\sqldba -CollectorSet 'System Correlation'

Gets a single sample for all counters for the 'System Correlation' CollectorSet on sql2017 and sql2016 using alternative credentials.

Example: 6
PS C:\> Get-DbaPfDataCollectorCounterSample -CollectorSet 'System Correlation'

Gets a single sample for all counters for the 'System Correlation' CollectorSet.

Optional Parameters

-ComputerName

The target computer. Defaults to localhost.

Alias
Required False
Pipeline false
Default Value $env:COMPUTERNAME
-Credential

Allows you to login to servers using alternative credentials. To use: $scred = Get-Credential, then pass $scred object to the -Credential parameter.

Alias
Required False
Pipeline false
Default Value
-CollectorSet

The Collector Set name.

Alias DataCollectorSet
Required False
Pipeline false
Default Value
-Collector

The Collector name.

Alias DataCollector
Required False
Pipeline false
Default Value
-Counter

The Counter name. This must be in the form of '\Processor(_Total)% Processor Time'.

Alias
Required False
Pipeline false
Default Value
-Continuous

If this switch is enabled, samples will be retrieved continuously until you press CTRL+C. By default, this command gets only one counter sample. You can use the SampleInterval parameter to set the interval for continuous sampling.

Alias
Required False
Pipeline false
Default Value False
-ListSet

Gets the specified performance counter sets on the computers. Enter the names of the counter sets. Wildcards are permitted.

Alias
Required False
Pipeline false
Default Value
-MaxSamples

Specifies the number of samples to get from each counter. The default is 1 sample. To get samples continuously (no maximum sample size), use the Continuous parameter. To collect a very large data set, consider running a Get-DbaPfDataCollectorCounterSample command as a Windows PowerShell background job.

Alias
Required False
Pipeline false
Default Value 0
-SampleInterval

Specifies the time between samples in seconds. The minimum value and the default value are 1 second.

Alias
Required False
Pipeline false
Default Value 0
-InputObject

Accepts the object output by Get-DbaPfDataCollectorCounter via the pipeline.

Alias
Required False
Pipeline true (ByValue)
Default Value
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message. This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting. Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

Alias
Required False
Pipeline false
Default Value False

 

Want to see the source code for this command? Check out Get-DbaPfDataCollectorCounterSample on GitHub.
Want to see the Bill Of Health for this command? Check out Get-DbaPfDataCollectorCounterSample.