Get-DbaPfDataCollector
View SourceSynopsis
Retrieves Windows Performance Monitor data collectors and their configuration details from local or remote computers.
Description
Retrieves detailed information about Windows Performance Monitor data collectors within collector sets, commonly used by DBAs to monitor SQL Server performance counters. This function parses the XML configuration of existing data collectors to show their settings, file locations, sample intervals, and the specific performance counters they collect.
Use this when you need to audit existing performance monitoring setups, verify collector configurations, or identify which performance counters are being captured for SQL Server baseline analysis and troubleshooting. The function works across multiple computers and integrates with Get-DbaPfDataCollectorSet for filtering specific collector sets.
Syntax
Get-DbaPfDataCollector
[[-ComputerName] <DbaInstanceParameter[]>]
[[-Credential] <PSCredential>]
[[-CollectorSet] <String[]>]
[[-Collector] <String[]>]
[[-InputObject] <Object[]>]
[-EnableException]
[<CommonParameters>]
Examples
Example: 1
PS C:\> Get-DbaPfDataCollector
Gets all Collectors on localhost.
Example: 2
PS C:\> Get-DbaPfDataCollector -ComputerName sql2017
Gets all Collectors on sql2017.
Example: 3
PS C:\> Get-DbaPfDataCollector -ComputerName sql2017, sql2016 -Credential ad\sqldba -CollectorSet 'System Correlation'
Gets all Collectors for the ‘System Correlation’ CollectorSet on sql2017 and sql2016 using alternative credentials.
Example: 4
PS C:\> Get-DbaPfDataCollectorSet -CollectorSet 'System Correlation' | Get-DbaPfDataCollector
Gets all Collectors for the ‘System Correlation’ CollectorSet.
Optional Parameters
-ComputerName
Specifies the target computer(s) to retrieve performance data collectors from. Defaults to localhost.
Use this to monitor performance collectors across multiple SQL Server environments or remote systems where SQL Server performance monitoring is configured.
| Property | Value |
|---|---|
| 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.
| Property | Value |
|---|---|
| Alias | |
| Required | False |
| Pipeline | false |
| Default Value |
-CollectorSet
Filters results to data collectors within specific collector sets by name. Accepts wildcards for pattern matching.
Use this when you want to examine collectors in a particular performance monitoring setup, such as ‘System Correlation’ or custom SQL Server baseline collector sets.
| Property | Value |
|---|---|
| Alias | DataCollectorSet |
| Required | False |
| Pipeline | false |
| Default Value |
-Collector
Filters results to specific data collectors by name within the collector sets. Accepts wildcards for pattern matching.
Use this when you need to examine a particular collector’s configuration, such as one focused on SQL Server counters or system resource monitoring.
| Property | Value |
|---|---|
| Alias | DataCollector |
| Required | False |
| Pipeline | false |
| Default Value |
-InputObject
Accepts collector set objects from Get-DbaPfDataCollectorSet via the pipeline to retrieve their individual data collectors.
Use this for pipeline operations when you want to drill down from collector sets to examine the specific performance counters and configuration details of their data collectors.
| Property | Value |
|---|---|
| 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.
| Property | Value |
|---|---|
| Alias | |
| Required | False |
| Pipeline | false |
| Default Value | False |
Outputs
PSCustomObject
Returns one object per data collector found within the specified collector sets. Each object represents a single Performance Monitor data collector configuration.
Default display properties (via Select-DefaultView):
- ComputerName: The name of the computer where the collector set is configured
- DataCollectorSet: The name of the parent data collector set containing this collector
- Name: The logical name of the data collector within the collector set
- DataCollectorType: The type of data collector (e.g., PerformanceCounterDataCollector)
- DataSourceName: The name of the performance counter data source being collected
- FileName: The base file name where performance counter data is written
- FileNameFormat: Format specification for the output file naming (e.g., monddyy)
- FileNameFormatPattern: The file naming pattern used for sequential file naming
- LatestOutputLocation: The full path where the most recent collector output is stored
- LogAppend: Boolean indicating if new data is appended to existing log files
- LogCircular: Boolean indicating if the log uses circular buffering (overwrites when full)
- LogFileFormat: The format of the log file (e.g., csv, binary, sql)
- LogOverwrite: Boolean indicating if existing log data is overwritten
- SampleInterval: The sampling interval in milliseconds between performance counter samples
- SegmentMaxRecords: The maximum number of records per log segment
- Counters: The collection of performance counters being collected by this collector
Additional properties available (not shown by default):
- CounterDisplayNames: Display names for the performance counters
- RemoteLatestOutputLocation: UNC path for accessing the latest output location remotely
- DataCollectorSetXml: The raw XML configuration of the parent data collector set
- CollectorXml: The raw XML configuration of this specific data collector
- DataCollectorObject: Flag indicating this is a data collector object
- Credential: The credential object used for remote access (if applicable) Use Select-Object * to access all properties available in the object.
dbatools