New-PefProcessTrigger
New-PefProcessTrigger
Creates a trigger that signals when a process exits.
구문
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>]
자세한 설명
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.
매개 변수
-Arguments<String>
Specifies parameters or parameter values that the cmdlet requires to invoke a process.
별칭 |
none |
필수 여부 |
false |
위치 |
2 |
기본값 |
none |
파이프라인 입력 적용 여부 |
false |
와일드카드 문자 허용 여부 |
false |
-FilePath<String>
Specifies the path and file name of the executable file that is to be invoked.
별칭 |
none |
필수 여부 |
true |
위치 |
1 |
기본값 |
none |
파이프라인 입력 적용 여부 |
false |
와일드카드 문자 허용 여부 |
false |
-InformationAction<System.Management.Automation.ActionPreference>
Specifies how this cmdlet responds to an information event. 이 매개 변수에 허용되는 값은 다음과 같습니다.
-- SilentlyContinue
-- Stop
-- Continue
-- Inquire
-- Ignore
-- Suspend
별칭 |
infa |
필수 여부 |
false |
위치 |
named |
기본값 |
none |
파이프라인 입력 적용 여부 |
false |
와일드카드 문자 허용 여부 |
false |
-InformationVariable<System.String>
Specifies a variable in which to store an information event message.
별칭 |
iv |
필수 여부 |
false |
위치 |
named |
기본값 |
none |
파이프라인 입력 적용 여부 |
false |
와일드카드 문자 허용 여부 |
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.
별칭 |
none |
필수 여부 |
false |
위치 |
named |
기본값 |
none |
파이프라인 입력 적용 여부 |
false |
와일드카드 문자 허용 여부 |
false |
<CommonParameters>
이 cmdlet은 일반 매개 변수 -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer 및 -OutVariable을 지원합니다. 자세한 내용은 다음을 참조하세요. about_CommonParameters(https://go.microsoft.com/fwlink/p/?LinkID=113216).
입력
입력 유형은 cmdlet에 파이프할 수 있는 개체의 유형입니다.
출력
출력 유형은 cmdlet이 내보내는 개체의 유형입니다.
예제
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")