commands

^

Get-DbaPfAvailableCounter

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

 

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

Synopsis

Gathers list of all available counters on local or remote machines.

Description

Gathers list of all available counters on local or remote machines. Note, if you pass a credential object, it will be included in the output for easy reuse in your next piped command.

Thanks to Daniel Streefkerk for this super fast way of counters
https://daniel.streefkerkonline.com/2016/02/18/use-powershell-to-list-all-windows-performance-counters-and-their-numeric-ids

Syntax

Get-DbaPfAvailableCounter
    [[-ComputerName] <DbaInstanceParameter[]>]
    [[-Credential] <PSCredential>]
    [[-Pattern] <String>]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Get-DbaPfAvailableCounter

Gets all available counters on the local machine.

Example: 2
PS C:\> Get-DbaPfAvailableCounter -Pattern *sql*

Gets all counters matching sql on the local machine.

Example: 3
PS C:\> Get-DbaPfAvailableCounter -ComputerName sql2017 -Pattern *sql*

Gets all counters matching sql on the remote server sql2017.

Example: 4
PS C:\> Get-DbaPfAvailableCounter -Pattern *sql*

Gets all counters matching sql on the local machine.

Example: 5
PS C:\> Get-DbaPfAvailableCounter -Pattern *sql* | Add-DbaPfDataCollectorCounter -CollectorSet 'Test Collector Set' -Collector DataCollector01

Adds all counters matching "sql" to the DataCollector01 within the 'Test Collector Set' 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
-Pattern

Specify a pattern for filtering.

Alias
Required False
Pipeline false
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