Export Counter - PowerShell


The Export-Counter cmdlet exports Performance Counter data to a text file or a comma-separated value (CSV) file. This is useful for saving performance data for later analysis or for sharing data with others.


Export-Counter [-Counter] <String[]> -Path <String> [-Delimiters <String[]>] [-Force] [-IncludeZero]


  • -Counter: Specifies the performance counters to export. Accepts an array of counter paths. If no counters are specified, data from all counters is exported.
  • -Path: Specifies the path to the file where the counter data will be saved. The file can be a text file or a CSV file.
  • -Delimiters (Optional): Specifies the delimiters to use between columns in the CSV file. Defaults to a comma.
  • -Force (Optional): Specifies that the file should be overwritten if it already exists.
  • -IncludeZero (Optional): Specifies that zero-value counters should be included in the exported data.


Simple Export

Export all performance counter data to a text file:

Export-Counter -Path "C:\PerfData.txt"

Export Specific Counters

Export data from specific performance counters to a CSV file:

Export-Counter -Counter "Processor(_Total)\% Processor Time", "Memory\Available MBytes" -Path "C:\PerfData.csv" -Delimiters ";,"

Include Zero-Value Counters

Export all performance counter data, including zero-value counters, to a text file:

Export-Counter -Path "C:\PerfData.txt" -IncludeZero

Common Issues

  • File permissions: Ensure you have sufficient permissions to write to the specified file path.
  • Invalid counter paths: Verify that the specified performance counter paths are valid. Use Get-Counter to list available counters.


  • Combine with Get-Counter to export data from specific counters.
  • Use Select-String or other text manipulation commands to filter or process the exported data.
  • Get-Counter
  • Set-Counter
  • New-Counter