CmdID / PowerShell / Cmdlets / Export
Export-Counter
Exports performance counter data to log files. PowerShell reference
From the PowerShell reference 6 parameters
What it does
Exports performance counter data to log files. The Export-Counter cmdlet exports performance counter data (PerformanceCounterSampleSet objects) to log files in binary performance log (.blg), comma-separated value (.csv), or tab-separated value (.tsv) format. You use this cmdlet to log performance counter data. The Export-Counter cmdlet is designed to export data that is returned by the Get-Counter and Import-Counter cmdlets. This cmdlet runs only on Windows 7, Windows Server 2008 R2, and later versions of Windows.
Export-Counter [-Path] <String> [-FileFormat <String>] [-MaxSize <UInt32>] -InputObject <PerformanceCounterSampleSet[]> [-Force] [-Circular] [<CommonParameters>]
EXAMPLE 1: Export counter data to a file
Get-Counter "\Processor(*)\% Processor Time" | Export-Counter -Path $HOME\Counters.blgIdentifyExport a file to a counter file format
$1GBInMB = 1024 # 1GB = 1024MB
Import-Counter Threads.csv | Export-Counter -Path ThreadTest.blg -Circular -MaxSize $1GBInMBIdentifyGet counter data from a remote computer and save the data to a file
$C = Get-Counter -ComputerName Server01 -Counter "\Process(*)\Working Set - Private" -MaxSamples $C | Export-Counter -Path \\Server01\Perf\WorkingSet.blgIdentifyRe-log existing data
$All = Import-Counter DiskSpace.blg
$LowSpace = $All | Where-Object {$_.CounterSamples.CookedValue -lt 15}
$LowSpace | Export-Counter -Path LowDiskSpace.blgIdentifyIts page in the reference: Export-Counter.
Parameters
-CircularIndicates that the output file is a circular log with first in, first out (FIFO) format. When you include this parameter, the MaxSize parameter is required.-FileFormatSpecifies the output format of the output log file.
The acceptable values for this parameter are:
- CSV
- TSV
- BLG
The default value is BLG.-ForceOverwrites and replaces an existing file if one exists in the location specified by the Path parameter.-InputObjectSpecifies, as an array, the counter data to export. Enter a variable that contains the data or a command that gets the data, such as the Get-Counter or Import-Counter cmdlet.-MaxSizeSpecifies the maximum size of the output file in megabytes (MB).
If the Circular parameter is specified, then when the log file reaches the specified maximum size, the oldest entries are deleted as newer ones are added. If the Circular parameter is not specified, then when the log file reaches the specified maximum size, no new data is added and the cmdlet generates a non-terminating error.-PathSpecifies the path and file name of the output file. Enter a relative or absolute path on the local computer, or a Uniform Naming Convention (UNC) path to a remote computer, such as \\Computer\Share\file.blg. This parameter is required.
The file format is determined by the value of the FileFormat parameter, not by the file name extension in the path.