Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Remove-DbaPfDataCollectorCounter on GitHub.
Want to see the Bill Of Health for this command? Check out Remove-DbaPfDataCollectorCounter.
Removes specific performance counters from Windows Performance Monitor Data Collector Sets.
Removes performance counters from existing Data Collector Sets in Windows Performance Monitor. This allows you to clean up monitoring configurations by removing counters that are no longer needed, reducing resource consumption and focusing on relevant metrics. Commonly used when fine-tuning SQL Server performance monitoring setups or removing counters that were added for troubleshooting specific issues.
Remove-DbaPfDataCollectorCounter
[[-ComputerName] <DbaInstanceParameter[]>]
[[-Credential] <PSCredential>]
[[-CollectorSet] <String[]>]
[[-Collector] <String[]>]
[-Counter] <Object[]>
[[-InputObject] <Object[]>]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Remove-DbaPfDataCollectorCounter -ComputerName sql2017 -CollectorSet 'System Correlation' -Collector DataCollector01 -Counter '\LogicalDisk(*)\Avg. Disk Queue Length'
Prompts for confirmation then removes the '\LogicalDisk(*)\Avg. Disk Queue Length' counter within the DataCollector01 collector within the System Correlation collector set on sql2017.
PS C:\> Get-DbaPfDataCollectorCounter | Out-GridView -PassThru | Remove-DbaPfDataCollectorCounter -Confirm:$false
Allows you to select which counters you'd like on localhost and does not prompt for confirmation.
Specifies the exact performance counter name(s) to remove from the data collector. Must use the full counter path format like '\Processor(_Total)% Processor Time' or '\SQLServer:Buffer
Manager\Buffer cache hit ratio'.
Use this when you need to remove specific SQL Server or system performance counters that are no longer needed for monitoring, such as counters added for troubleshooting that are now consuming
unnecessary resources.
Alias | Name |
Required | True |
Pipeline | true (ByPropertyName) |
Default Value |
Specifies the target computer(s) where the Performance Monitor Data Collector Set is configured. Accepts multiple computer names for bulk operations.
Use this when you need to remove counters from collector sets on remote SQL Server machines or when managing performance monitoring across multiple servers.
Alias | |
Required | False |
Pipeline | false |
Default Value | $env:COMPUTERNAME |
Allows you to login to the target computer using alternative credentials. To use:
$cred = Get-Credential, then pass $cred object to the -Credential parameter.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Specifies the name of the Performance Monitor Data Collector Set containing the counters to be removed. Supports wildcards for pattern matching across multiple sets.
Use this when you know the specific collector set name where your performance counters are configured, such as 'System Correlation' or custom SQL Server monitoring sets.
Alias | DataCollectorSet |
Required | False |
Pipeline | false |
Default Value |
Specifies the name of the individual data collector within the collector set that contains the performance counters to remove. Supports multiple collector names.
Use this to target specific data collectors when your collector set contains multiple collectors, allowing you to remove counters from only the collectors you specify.
Alias | DataCollector |
Required | False |
Pipeline | false |
Default Value |
Accepts performance counter objects from Get-DbaPfDataCollectorCounter via the pipeline, allowing you to remove counters discovered through previous queries.
Use this when you want to first review existing counters with Get-DbaPfDataCollectorCounter and then selectively remove specific ones through pipeline operations.
Alias | |
Required | False |
Pipeline | true (ByValue) |
Default Value |
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 |
If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |