Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 3.0 » Register-EngineEvent

Register-EngineEvent - Powershell 3.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Register-EngineEvent

Short description
Subscribes to events that are generated by the Windows PowerShell engine and by the New-Event cmdlet.

Syntax
Register-EngineEvent [-SourceIdentifier] <String> [[-Action] <ScriptBlock>] [-Forward] [-MaxTriggerCount <Int32>] [-Mes
sageData <PSObject>] [-SupportEvent] [<CommonParameters>]





Description
The Register-EngineEvent cmdlet subscribes to events that are generated by the Windows PowerShell engine and the New-Ev
ent cmdlet. Use the SourceIdentifier parameter to specify the event.


You can use this cmdlet to subscribe to the "Exiting" engine event and events generated by the New-Event cmdlet. These 
events are automatically added to your event queue in your session without subscribing. However, subscribing lets you f
orward the events, specify an action to respond to the events, and cancel the subscription.


When the subscribed event is raised, it is added to the event queue in your session. To get events in the event queue, 
use the Get-Event cmdlet.


When you subscribe to a event, an event subcriber is added to your session. To get the event subscribers in the session
, use the Get-EventSubscriber cmdlet. To cancel the subscription, use the Unregister-Event cmdlet, which deletes the ev
ent subscriber from the session.