Skip to content

Latest commit

 

History

History
245 lines (178 loc) · 4.91 KB

File metadata and controls

245 lines (178 loc) · 4.91 KB
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-Trace

SYNOPSIS

Start an Event Trace logging session.

SYNTAX

Start-Trace [-SessionName] <String> [[-OutputFilePath] <String>] [[-ProviderFilePath] <String>]
 [-ETS] [-Format <String>] [-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

$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 @parameters

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: None
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

You can't pipe objects to this cmdlet.

OUTPUTS

None

This cmdlet returns no output.

NOTES

RELATED LINKS

Event Tracing

Stop-Trace

Disable-PSWSManCombinedTrace

Disable-WSManTrace

Enable-PSWSManCombinedTrace

Enable-WSManTrace