Skip to content

Start-Trace

SYNOPSIS

Start an Event Trace logging session.

SYNTAX

Start-Trace [-SessionName] <String> [[-OutputFilePath] <String>] [[-ProviderFilePath] <String>] [-ETS]
 [-Format <Object>] [-MinBuffers <Int32>] [-MaxBuffers <Int32>] [-BufferSizeInKB <Int32>]
 [-MaxLogFileSizeInMB <Int32>] [<CommonParameters>]

DESCRIPTION

> 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-PSWSManCombinedTrace`
  • `Enable-WSManTrace`

You must run this cmdlet from an elevated PowerShell session.

EXAMPLES

Example 1: Start a WSMan Trace logging session

Start-Trace -SessionName 'wsmlog' -ETS -OutputFilePath "$env:windir\system32\wsmtraces.log" -Format 'bincirc' -MinBuffers 16 -MaxBuffers 256 -BufferSizeInKb 64 -MaxLogFileSizeInMB 256 -ProviderFilePath "$env:windir\system32\wsmtraceproviders.txt"

PARAMETERS

-BufferSizeInKB

Event 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: False

-ETS

Send 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: False
Accept pipeline input: False
Accept wildcard characters: False

-Format

Specifies 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: False

-MaxBuffers

Sets 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: False

-MaxLogFileSizeInMB

Sets 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: False

-MinBuffers

Sets 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: False

-OutputFilePath

Path 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: False

-ProviderFilePath

File 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: False

-SessionName

The 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: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

None

OUTPUTS

None

NOTES

Event Tracing

Stop-Trace

Disable-PSWSManCombinedTrace

Disable-WSManTrace

Enable-PSWSManCombinedTrace

Enable-WSManTrace

Back to top