Condividi tramite


New-PefProcessTrigger

New-PefProcessTrigger

Creates a trigger that signals when a process exits.

Sintassi

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

Descrizione dettagliata

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.

Parametri

-Arguments<String>

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

Alias

none

Obbligatorio?

false

Posizione?

2

Valore predefinito

none

Accetta input da pipeline?

false

Accetta caratteri jolly?

false

-FilePath<String>

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

Alias

none

Obbligatorio?

true

Posizione?

1

Valore predefinito

none

Accetta input da pipeline?

false

Accetta caratteri jolly?

false

-InformationAction<System.Management.Automation.ActionPreference>

Specifies how this cmdlet responds to an information event. I valori accettabili per questo parametro sono:

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

Alias

infa

Obbligatorio?

false

Posizione?

named

Valore predefinito

none

Accetta input da pipeline?

false

Accetta caratteri jolly?

false

-InformationVariable<System.String>

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

Alias

iv

Obbligatorio?

false

Posizione?

named

Valore predefinito

none

Accetta input da pipeline?

false

Accetta caratteri jolly?

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.

Alias

none

Obbligatorio?

false

Posizione?

named

Valore predefinito

none

Accetta input da pipeline?

false

Accetta caratteri jolly?

false

<CommonParameters>

Questo cmdlet supporta i parametri comuni: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer e -OutVariable. Per altre informazioni, vedere   about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Input

Il tipo di input è il tipo degli oggetti che è possibile reindirizzare al cmdlet.

Output

Il tipo di output corrisponde al tipo di oggetti generati dal cmdlet.

Esempi

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")

Argomenti correlati

New-PefTraceSession

Add-PefMessageSource

New-PefDateTimeTrigger

Stop-PefTraceSession

Start-PefTraceSession