| external help file | PSDiagnostics-help.xml |
|---|---|
| Locale | en-US |
| Module Name | PSDiagnostics |
| ms.date | 12/12/2022 |
| online version | https://learn.microsoft.com/powershell/module/psdiagnostics/start-trace?view=powershell-7.6&WT.mc_id=ps-gethelp |
| schema | 2.0.0 |
| title | Start-Trace |
Start an Event Trace logging session.
Start-Trace [-SessionName] <String> [[-OutputFilePath] <String>] [[-ProviderFilePath] <String>]
[-ETS] [-Format <String>] [-MinBuffers <Int32>] [-MaxBuffers <Int32>]
[-BufferSizeInKB <Int32>] [-MaxLogFileSizeInMB <Int32>] [<CommonParameters>]
This cmdlet is only available on the Windows platform.
This cmdlet starts a Windows Event Trace logging session.
This cmdlet is used by the following cmdlets:
Enable-PSWSManCombinedTraceEnable-WSManTrace
You must run this cmdlet from an elevated PowerShell session.
$parameters = @{
SessionName = 'wsmlog'
ETS = $true
OutputFilePath = "$Env:windir\system32\wsmtraces.log"
Format = 'bincirc'
MinBuffers = 16
MaxBuffers = 256
BufferSizeInKb = 64
MaxLogFileSizeInMB = 256
ProviderFilePath = "$Env:windir\system32\wsmtraceproviders.txt"
}
Start-Trace @parametersEvent Trace Session buffer size in kilobytes (KB).
Type: System.Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: FalseSend commands to Event Trace Sessions directly without saving or scheduling.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the log format for the data collector. For SQL database format, you must use the
OutputFilePath option in the command line with the dsn!log value. The default is binary
(bin). The possible values are:
- bin - binary
- bincirc - binary with circular logging
- csv - Comma-separated values
- tsv - Tab-separated values
- sql - SQL database
Type: System.Object
Parameter Sets: (All)
Aliases:
Accepted values: bin, bincirc, csv, tsv, sql
Required: False
Position: Named
Default value: bin
Accept pipeline input: False
Accept wildcard characters: FalseSets the maximum number of Event Trace Session buffers.
Type: System.Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 256
Accept pipeline input: False
Accept wildcard characters: FalseSets the maximum log file size in megabytes (MB) or number of records for SQL logs.
Type: System.Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 0 (no limit)
Accept pipeline input: False
Accept wildcard characters: FalseSets the minimum number of Event Trace Session buffers.
Type: System.Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: FalsePath of the output log file or the DSN and log set name in a SQL database. The default path is
$Env:SystemDrive\PerfLogs\Admin.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: $Env:SystemDrive\PerfLogs\Admin
Accept pipeline input: False
Accept wildcard characters: FalseFile listing multiple Event Trace providers to enable.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe name of the Event Trace session. To stop a trace session you must know the session name.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
You can't pipe objects to this cmdlet.
This cmdlet returns no output.