Share via


New-PefProcessTrigger

New-PefProcessTrigger

Creates a trigger that signals when a process exits.

Syntax

Parameter Set: Default
New-PefProcessTrigger [-FilePath] <String> [[-Arguments] <String> ] [-InformationAction <System.Management.Automation.ActionPreference> {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend} ] [-InformationVariable <System.String> ] [-Repeat] [ <CommonParameters>]

Detaillierte Beschreibung

The New-PefProcessTrigger cmdlet creates a trigger that signals when a process exits. You can use this process trigger to invoke a process at the time you start a Protocol Engineering Framework (PEF) Trace Session with the Start-PefTraceSession cmdlet. The trigger executes the process when it becomes associated with a PEF action. When the process exits, the trigger signals. The trigger becomes active when you associate it to a PEF action.

Parameter

-Arguments<String>

Specifies parameters or parameter values that the cmdlet requires to invoke a process.

Aliasse

none

Erforderlich?

false

Position?

2

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-FilePath<String>

Specifies the path and file name of the executable file that is to be invoked.

Aliasse

none

Erforderlich?

true

Position?

1

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

-Repeat

Indicates that the trigger runs on each occurrence of invoking a process. If you do not specify this parameter, the trigger runs only once.

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 a trigger that invokes a process

This example adds a trigger to a linear PEF Trace Session that invokes the ping.exe process when the Start-PefTraceSession cmdlet runs. The session actually starts when the ping command completes.

The first command uses the New-PefTraceSession cmdlet to create a Trace Session object and stores it in the $TraceSession01 variable.

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

The third command uses the Stop-PefTraceSession cmdlet to stop the Trace Session stored in the $TraceSession01 variable ten minutes after the session starts, by using the New-PefDateTimeTrigger cmdlet.

The fourth command uses the Start-PefTraceSession cmdlet to start the Trace Session stored in the $TraceSession01 variable. The invoked process in the example is Ping.exe, which pings a location specified by the Arguments parameter. The sessions starts when the invoked process stops. Note that the 4 parameter value forces the use of IPv4; if unspecified, the default IP transport is used.

PS C:\> $TraceSession01 = New-PefTraceSession -Mode Linear -Name ".\myTrace.matu" -SaveOnStop -Path "C:\Traces\result.matu" -Force
PS C:\> Add-PefMessageSource -PEFSession $TraceSession01 -Source "Microsoft-Pef-WFP-MessageProvider"
PS C:\> Stop-PefTraceSession -PEFSession $TraceSession01 -Trigger (New-PefDateTimeTrigger ($dt=Get-Date).AddMinutes(10))
PS C:\> Start-PefTraceSession -PEFSession $TraceSession01 -Trigger (New-PefProcessTrigger -FilePath C:\Windows\system32\PING.EXE -Arguments "www.contoso.com -4")

Verwandte Themen

New-PefTraceSession

Add-PefMessageSource

New-PefDateTimeTrigger

Stop-PefTraceSession

Start-PefTraceSession