New-PefKeyDownTrigger
New-PefKeyDownTrigger
Creates a trigger that you run by using a specified keystroke.
Syntax
Parameter Set: Default
New-PefKeyDownTrigger [-CtrlC] [-Key <Char[]> ] [-Repeat] [ <CommonParameters>]
Detailed Description
The New-PefKeyDownTrigger cmdlet creates a trigger based on keyboard input, where the user presses Ctrl+C to activate the trigger. You can use this keystroke trigger to start or stop Protocol Engineering Framework (PEF) Trace Sessions. The server activates the trigger when you associate the trigger with the PEF action.
Parameters
-CtrlC
Indicates that the trigger runs when you press Ctrl+C.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Key<Char[]>
This parameter is not currently used. Ctrl+C is the only keystroke trigger that you can use to start or stop a PEF Trace Session.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Repeat
Indicates that the trigger runs on each occurrence of the keyboard input that you specify.
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: Stop a Trace Session by using a keystroke trigger
This example starts a PEF Trace Session.
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 specify a provider for the Trace Session stored in the $TraceSession01 variable.
The third command uses the New-PefKeyDownTrigger cmdlet to create a new keystroke trigger object and stores it in the $Trigger01 variable.
The fourth command uses the Stop-PefCaptureSession cmdlet to create a stop action for the trigger stored in the $Trigger01 variable and associates that action with the Trace Session stored in the $TraceSession01 variable.
The sixth command uses the Start-PefCaptureSession cmdlet to start the Trace Session stored in the $TraceSession01 variable.
PS C:\> $TraceSession01 = New-PefCaptureSession
PS C:\> Add-PefMessageProvider -Session $TraceSession01 –Provider "Microsoft-PEF-NDIS-PacketCapture"
PS C:\> $Trigger01 = New-PefKeyDownTrigger -CTRLC
PS C:\> Stop-PefCaptureSession -Session $TraceSession01 -Trigger $Trigger01
PS C:\> Start-PefCaptureSession -Session $TraceSession01