New-PefWin32EventTrigger

New-PefWin32EventTrigger

Creates a trigger that signals when a specified Win32 system event is raised.

구문

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

자세한 설명

The New-PefWin32EventTrigger cmdlet creates a trigger that signals when a specified Win32 system event is raised. Use a Win32 system event object to control when to start or stop a trace, or trigger other actions, from the process that creates the event. The trigger becomes active when you associate it with a Protocol Engineering Framework (PEF) action.

매개 변수

-CheckTimerPeriodMs<Int32>

Specifies how often, in milliseconds, to check for an event. The default value is 1000 ms.

별칭

none

필수 여부

false

위치

named

기본값

none

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-EventName<String>

Specifies the name of the event to wait for.

별칭

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 the event. 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 aWin32 event trigger that stops a trace session

This example creates a Win32 system event trigger, and then associates it to a Trace Session. The Trace Session stops when the trigger signals the named system event.

The first command creates a trigger object for a Win32 system event named TestEvent, and then stores in the $Trigger01 variable. The trigger checks for the event every five milliseconds.

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

The third command uses the Add-PefMessageSource cmdlet to specify a provider for the session that is stored in $TraceSession01.

The fourth command uses the Stop-PefTraceSession cmdlet to create a stop action for the Win32 system event trigger stored in $Trigger01, and associates that action with the session that is stored in $TraceSession01. An external process can now signal the event to stop the trace.

The final command uses the Start-PefTraceSession cmdlet to start the session that is stored in $TraceSession01.

PS C:\> $Trigger01 = New-PefWin32EventTrigger -EventName "TestEvent" -CheckTimerPeriodMs 5
PS C:\> $TraceSession01 = New-PefTraceSession -Mode Linear -Force -Path "C:\traces\Win32Event" -Name "TestEventLogEventScenario" -SaveOnStop 
PS C:\> Add-PefMessageSource -PEFSession $TraceSession01 -Source "Microsoft-Pef-WFP-MessageProvider" 
PS C:\> Stop-PefTraceSession -PEFSession $TraceSession01 -Trigger $Trigger01
PS C:\> Start-PefTraceSession -PEFSession $TraceSession01

관련 항목

Add-PefMessageSource

New-PefEventLogTrigger

New-PefTraceSession

Start-PefTraceSession

Stop-PefTraceSession