Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Remove-DbaPfDataCollectorSet on GitHub.
Want to see the Bill Of Health for this command? Check out Remove-DbaPfDataCollectorSet.
Removes Windows Performance Monitor Data Collector Sets from local or remote computers
Removes Windows Performance Monitor Data Collector Sets that are no longer needed for SQL Server performance monitoring. This is useful for cleaning up old monitoring configurations, freeing disk space, or standardizing performance monitoring setups across your SQL Server environment. The collector set must be stopped before removal - running collector sets will generate an error and must be stopped first using Stop-DbaPfDataCollectorSet. When removing collector sets from the local computer, administrator privileges are required.
Remove-DbaPfDataCollectorSet
[[-ComputerName] <DbaInstanceParameter[]>]
[[-Credential] <PSCredential>]
[[-CollectorSet] <String[]>]
[[-InputObject] <Object[]>]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Remove-DbaPfDataCollectorSet
Prompts for confirmation then removes all ready Collectors on localhost.
PS C:\> Remove-DbaPfDataCollectorSet -ComputerName sql2017 -Confirm:$false
Attempts to remove all ready Collectors on localhost and does not prompt to confirm.
PS C:\> Remove-DbaPfDataCollectorSet -ComputerName sql2017, sql2016 -Credential ad\sqldba -CollectorSet 'System Correlation'
Prompts for confirmation then removes the 'System Correlation' Collector on sql2017 and sql2016 using alternative credentials.
PS C:\> Get-DbaPfDataCollectorSet -CollectorSet 'System Correlation' | Remove-DbaPfDataCollectorSet
Removes the 'System Correlation' Collector.
PS C:\> Get-DbaPfDataCollectorSet -CollectorSet 'System Correlation' | Stop-DbaPfDataCollectorSet | Remove-DbaPfDataCollectorSet
Stops and removes the 'System Correlation' Collector.
Specifies the target computer(s) where Performance Monitor Data Collector Sets will be removed. Supports multiple computers for bulk operations.
Use this when removing collector sets from remote SQL Server hosts or when standardizing monitoring configurations 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 exact name(s) of the Performance Monitor Data Collector Sets to remove. Accepts multiple collector set names for batch operations.
Use this when you need to remove specific monitoring configurations rather than all available collector sets on the target computer.
Alias | DataCollectorSet |
Required | False |
Pipeline | false |
Default Value |
Accepts Data Collector Set objects from Get-DbaPfDataCollectorSet for pipeline operations. Enables chaining commands together for workflow automation.
Use this when you need to filter collector sets with Get-DbaPfDataCollectorSet first, then remove only the matching results.
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 |