Contact Info

Crumbtrail » Administration » Powershell » Powershell 3.0 » Register-ObjectEvent

Register-ObjectEvent - 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 »


Short description
Subscribes to the events that are generated by a Microsoft .NET Framework object.

Register-ObjectEvent [-InputObject] <PSObject> [[-SourceIdentifier] <String>] [[-Action] <ScriptBlock>] [-EventName] <S
tring> [-Forward] [-MaxTriggerCount <Int32>] [-MessageData <PSObject>] [-SupportEvent] [<CommonParameters>]

The Register-ObjectEvent cmdlet subscribes to events that are generated by .NET Framework objects on the local computer
 or on a remote computer.

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.

You can use the parameters of Register-ObjectEvent to specify property values of the events that can help you to identi
fy the event in the queue. You can also use the Action parameter to specify actions to take when a subscribed event is 
raised and the Forward parameter to send remote events to the event queue in the local session.

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