Invoke-PefCustomAction

Invoke-PefCustomAction

Creates a PEF action that runs a script block.

구문

Parameter Set: Default
Invoke-PefCustomAction [-Script] <ScriptBlock> [-InformationAction <System.Management.Automation.ActionPreference> {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend} ] [-InformationVariable <System.String> ] [-Trigger <Trigger[]> ] [ <CommonParameters>]

자세한 설명

The Invoke-PefCustomAction cmdlet creates a Protocol Engineering Framework (PEF) action that runs a Microsoft PowerShell script block. Specify a script block to run and a trigger for the action.

매개 변수

-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

-Script<ScriptBlock>

Specifies a script block to invoke. For more information about script blocks, type Get-Help about_script_blocks.

별칭

none

필수 여부

true

위치

1

기본값

none

파이프라인 입력 적용 여부

false

와일드카드 문자 허용 여부

false

-Trigger<Trigger[]>

Specifies an array of Trigger objects. When one of these triggers runs, the action runs the script block specified by the Script parameter.

별칭

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 an ICMP trigger actionn

This command creates a script block, stored in the variable $Sb, that Invoke-PefCustomAction runs when the trigger criteria matches. The New-PefMessageTrigger cmdlet defines the trigger by specifying a filter for ICMP. When the trigger matches, the script block runs, which displays the message ICMP found.

PS C:\>  $T = New-PefKeyDownTrigger -CtrlC
PS C:\> $Sb = { $Host.UI.WriteErrorLine("ICMP found") }
PS C:\> $S = New-PefTraceSession -Mode Linear -SaveOnStop -Path "C:\Traces\Simple" -Force -SaveAsParsed
PS C:\> Add-PefMessageSource -PEFSession $S -Source Microsoft-Pef-WFP-MessageProvider
PS C:\> $T2 = New-PefMessageTrigger  -PEFSession $S -Filter "ICMP" -Repeat
PS C:\> Invoke-PefCustomAction -Script $Sb -Trigger $T2
PS C:\> Stop-PefTraceSession -PEFSession $S -Trigger $T
PS C:\> Start-PefTraceSession -PEFSession $S 

관련 항목

New-PefDateTimeTrigger

New-PefKeyDownTrigger

New-PefMessageTrigger

New-PefProcessTrigger

New-PefTimeSpanTrigger