Register-CommanderEvent
SYNOPSIS
Registers a handler to invoke when an event takes place.
SYNTAX
Commander
Register-CommanderEvent -OnCommander <String> -Action <ScriptBlock> [<CommonParameters>]
Windows
Register-CommanderEvent -OnWindows <String> [-WmiEventType <String>] [-WmiEventFilter <String>]
-Action <ScriptBlock> [<CommonParameters>]
DESCRIPTION
Registers a handler to invoke when an event takes place.
EXAMPLES
EXAMPLE 1
Register-CommanderEvent -OnCommander Start -Action {
Start-Process notepad
}
Starts notepad when commander starts.
PARAMETERS
-OnCommander
Specifies event handlers for events within commander.
Type: System.String
Parameter Sets: Commander
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-OnWindows
Specifies event handlers for events within Windows.
Type: System.String
Parameter Sets: Windows
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-WmiEventType
Specifies the WMI event type to query when using -OnWindows WmiEvent
Type: System.String
Parameter Sets: Windows
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-WmiEventFilter
Specifies the WMI event filter to query when using -OnWindows WmiEvent
Type: System.String
Parameter Sets: Windows
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Action
The action to invoke when an event takes place.
Type: System.Management.Automation.ScriptBlock
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.