Export (0) Print
Expand All

New-PefProcessTrigger

Windows Server 2012 R2 and Windows 8.1

Updated: October 17, 2013

Applies To: Windows 8.1, Windows PowerShell 4.0, Windows Server 2012 R2

New-PefProcessTrigger

Creates a trigger that signals when a process exits.

Syntax

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




Detailed Description

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.

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. If you do not specify this parameter, the trigger runs only once.


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 command executes. The session 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-PefMessageProvider 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 argument value forces the use of IPv4; if unspecified, the default IP transport will be used.


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

Related topics

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft