dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Get-DbaPfAvailableCounter

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.

Screenshots

dbatools-Get-DbaPfAvailableCounter

Examples

Gets all available counters on the local machine.

Get-DbaPfAvailableCounter

Gets all counters matching sql on the local machine.

Get-DbaPfAvailableCounter -Pattern sql

Gets all counters matching sql on the remote server sql2017.

Get-DbaPfAvailableCounter -ComputerName sql2017 -Pattern sql

Gets all counters matching sql on the local machine.

Get-DbaPfAvailableCounter -Pattern sql

Adds all counters matching “sql” to the DataCollector01 within the ‘Test Collector Set’ CollectorSet.

Get-DbaPfAvailableCounter -Pattern sql | Add-DbaPfDataCollectorCounter -CollectorSet ‘Test Collector Set’ -Collector DataCollector01

Author

This command was created by Chrissy LeMaire. You can find Chrissy on Twitter.

Get-Help

From PowerShell, execute Get-Help Get-DbaPfAvailableCounter -Detailed for more information on this function.

Source Code

Want to see the source code? View Get-DbaPfAvailableCounter.ps1 on GitHub
 

Related commands