Share via


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>]

Detaillierte Beschreibung

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.

Parameter

-Filter<String>

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

Aliasse

none

Erforderlich?

false

Position?

2

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-InformationAction<System.Management.Automation.ActionPreference>

Specifies how this cmdlet responds to an information event. Die folgenden Werte für diesen Parameter sind zulässig:

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

Aliasse

infa

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-InformationVariable<System.String>

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

Aliasse

iv

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-Mode<PEFSessionMode>

Specifies a mode for the Trace Session. Die folgenden Werte für diesen Parameter sind zulässig:

-- 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.

Aliasse

none

Erforderlich?

false

Position?

1

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

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.

Aliasse

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

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.

Aliasse

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

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.

Aliasse

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-Silent

Indicates that the cmdlet shows no output.

Aliasse

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

<CommonParameters>

Dieses Cmdlet unterstützt die allgemeinen Parameter: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, -OutVariable. Weitere Informationen finden Sie unter about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Eingaben

Der Eingabetyp ist der Typ der Objekte, die über die Pipeline an das Cmdlet übergeben werden können.

Ausgaben

Der Ausgabetyp ist der Typ der Objekte, die vom Cmdlet ausgegeben werden.

Beispiele

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

Verwandte Themen

Start-PefTraceSession

Stop-PefTraceSession

Add-PefMessageSource

New-PefKeyDownTrigger