New-PefTraceSession

New-PefTraceSession

Creates a PEF Trace Session.

Syntax

Parameter Set: Default
New-PefTraceSession [[-Mode] <PEFSessionMode> {Circular | Linear} ] [[-Filter] <String> ] [-InformationAction <System.Management.Automation.ActionPreference> {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend} ] [-InformationVariable <System.String> ] [-Name <String> ] [-SaveAsParsed] [-SaveOnStop] [-Silent] [ <CommonParameters>]

Detailed Description

The New-PefTraceSession cmdlet creates a Protocol Engineering Framework (PEF) Trace Session to capture live data or to load message data from saved trace files or logs. This cmdlet enables you to specify a mode, either Circular or Linear, to control how much data the Trace Session holds. You can also specify a filter that selects specific types of messages during data retrieval, either from a Live Trace Session or from saved files and logs. Use the SaveOnStop parameter to save a data collection to a file when the Trace Session stops.

You can use the Add-PefMessageSource cmdlet to specify a message provider for a capture session.

After you create a Trace Session object, use the Start-PefTraceSession and Stop-PefTraceSession cmdlets to define how the session will start and stop collecting message data.

You need to be a member of the Message Capture Users Group and the Performance Log Users Group.

Parameters

-Filter<String>

Specifies a string that configures a Trace Filter, which defines the types of messages that a Trace Session retrieves.

Aliases

none

Required?

false

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-InformationAction<System.Management.Automation.ActionPreference>

Specifies how this cmdlet responds to an information event. The acceptable values for this parameter are:

-- SilentlyContinue
-- Stop
-- Continue
-- Inquire
-- Ignore
-- Suspend

Aliases

infa

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-InformationVariable<System.String>

Specifies a variable in which to store an information event message.

Aliases

iv

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Mode<PEFSessionMode>

Specifies a mode for the Trace Session. The acceptable values for this parameter are:

-- Circular. The Trace Session records data until the data size reaches a limit defined by the TotalSize dynamic parameter, and then the session records new data while discarding the oldest recorded data.
-- Linear. The session does not discard data.

The default value for this parameter is Linear.

Aliases

none

Required?

false

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Name<String>

Specifies an input file path. If you use the SaveOnStop parameter, you can specify this parameter to cause the Trace Session to retrieve input data from the specified file.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SaveAsParsed

Indicates that the cmdlet parses all messages fully, and saves them as a .matp file. By default, the cmdlet saves trace data as unparsed. The parsed data in a .matp file loads more quickly. The operation of parsing during capture causes the cmdlet to capture data more slowly.

If you specify the Circular value for the Mode parameter, you should not specify the SaveAsParsed parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SaveOnStop

Indicates that the Trace Session saves data when it stops. You can use the Name dynamic parameter to specify a file path for saving the data.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Silent

Indicates that the cmdlet shows no output.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Create and run a PEF Trace Session

This example creates and starts a PEF Trace Session.

The first command creates a Trace Session object and stores it in the $TraceSession01 variable. This command specifies the Circular capture mode, with a total size of 50 MB. The command also uses the SaveOnStop parameter and specifies a name for the trace file Trace01.matu, by using the Path parameter, which saves the Trace Session results in the current directory. The command uses the Force parameter, which causes any existing file of the same name to be overwritten when your Trace Session results are saved.

The second command uses the Add-PefMessageSource cmdlet to specify a provider for the Trace Session stored in the $TraceSession01 variable.

The final command uses the Start-PefTraceSession cmdlet to start the Trace Session stored in $TraceSession01.

PS C:\> $TraceSession01 = New-PefTraceSession -Mode Circular -Force -Path "C:\Traces\Trace01.matu" -TotalSize 50 -SaveOnStop
PS C:\> Add-PefMessageSource -PEFSession $TraceSession01 –Source "Microsoft-Pef-WFP-MessageProvider"
PS C:\> Start-PefTraceSession -PEFSession $TraceSession01

Start-PefTraceSession

Stop-PefTraceSession

Add-PefMessageSource

New-PefKeyDownTrigger