New-PefProcessTrigger

New-PefProcessTrigger

Creates a trigger that invokes a process.

Syntax

Parameter Set: Default
New-PefProcessTrigger [-FilePath] <String> [[-Arguments] <String> ] [-Repeat] [ <CommonParameters>]

Detailed Description

The New-PefProcessTrigger cmdlet creates a process trigger. 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-PefCaptureSession cmdlet. The trigger fires when the associated Trace Session is started.

Parameters

-Arguments<String>

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

Aliases

none

Required?

false

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-FilePath<String>

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

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Repeat

Indicates that the trigger runs on each occurrence of invoking a process .

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.

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 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 Trace Session starts.

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

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

The third command uses the Stop-PefCaptureSession 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-PefCaptureSession cmdlet to start the Trace Session stored in the $TraceSession01 variable, and invokes an executable process at that time with the use of the New-PefProcessTrigger cmdlet. The invoked process in the example is Ping.exe, which pings a location specified by the Arguments parameter. Note that the -4 argument value forces the use of IPv4; if unspecified, the default IP transport will be used.

PS C:\>  
$TraceSession01 = New-PefCaptureSession -Mode  Linear  -Name ".\myTrace.matu" -SaveOnStop -Path  “.\result.matu” -Force
PS C:\> Add-PefMessageProvider -Provider  “Microsoft-PEF-NDIS-PacketCapture”
PS C:\>  
Stop-PefCaptureSession -Trigger (New-PefDateTimeTrigger ($dt=Get-Date).AddMinutes(10))
PS C:\>  
Start-PefCaptureSession -Session $TraceSession01 -Trigger (New-PefProcessTrigger -FilePath C:\Windows\system32\PING.EXE -Arguments "www.bing.com -4")

 

New-PefCaptureSession

Add-PefMessageProvider

New-PefDateTimeTrigger

New-PefProcessTrigger

Stop-PefCaptureSession

Start-PefCaptureSession