Backup Exec Management Command Line Interface Help
Register-BEEvent Cmdlet
Synopsis

Notifies a recipient of an event in Backup Exec.

Syntax
Register-BEEvent [-Event] {AlertChanged | ActiveJobChanged | JobCompleted} [[-SourceIdentifier] [<String>]] [[-Action] [<ScriptBlock>]] [-MessageData [<PSObject>]] [-SupportEvent [<SwitchParameter>]] [-Forward [<SwitchParameter>]] [<CommonParameters>]
Description

Notifies a recipient of an event in Backup Exec.

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

When you are notified of an event, an event subscriber is added to your session. To get the event subscribers in the session, use the Get-EventSubscriber cmdlet. To cancel the notification, use the Unregister-Event cmdlet, which deletes the event subscriber from the session.

Parameters

-Event

Specifies the event of which you want to be notified.

The valid values are:
AlertChanged
ActiveJobChanged
JobCompleted


Required true
Position 0
Accepts pipeline input false
Accepts wildcard characters false


-SourceIdentifier <String>

Specifies a name that you select for the notification. The name that you select must be unique in the current session. The default value is the GUID that Windows PowerShell assigns.


Required false
Position 100
Accepts pipeline input false
Accepts wildcard characters false


-Action <ScriptBlock>

Specifies commands to handle the events.

The commands in the Action run when an event occurs, instead of sending the event to the event queue. Enclose the commands in braces ( { } ) to create a script block. The value of the Action parameter can include the $Event, $EventSubscriber, $Sender, $SourceEventArgs, and $SourceArgs automatic variables, which provide information about the event to the Action script block. For more information, see about_Automatic_Variables.

When you specify an action, Register-BEEvent returns an event job object that represents that action. You can use the Job cmdlets to manage the event job.


Required false
Position 101
Accepts pipeline input false
Accepts wildcard characters false


-MessageData <PSObject>

Specifies any additional data taht you want to associate with this event. The value of this parameter appears in the MessageData property of all events associated with this notification.


Required false
Position Named
Accepts pipeline input false
Accepts wildcard characters false


-SupportEvent <SwitchParameter>

Hides the event notification. Use this parameter when the current notification is part of a more complex event registration mechanism and it should not be discovered independently.

To view or cancel a notification that was created with the SupportEvent parameter, use the Force parameter of the Get-EventSubscriber and Unregister-Event cmdlets.


Required false
Position Named
Accepts pipeline input false
Accepts wildcard characters false


-Forward <SwitchParameter>

Sends events for this notification to a remote session. Use this parameter when you are registering for events on a remote computer or in a remote session.


Required false
Position Named
Accepts pipeline input false
Accepts wildcard characters false


<CommonParameters>

For more information about common parameters, type "Get-Help about_commonparameters".

Input Type
None

This cmdlet does not accept any input.

Return Value
None or System.Management.Automation.PSEventJob

If you use the Action parameter, Register-EngineEvent returns a System.Management.Automation.PSEventJob object. Otherwise, it does not generate any output.

Examples

Example 1

C:\PS> Register-BEEvent -Event JobCompleted

This command subscribes to events generated when a Backup Exec job completes.


Example 2
C:\PS> $voice = New-Object -ComObject sapi.spvoice
C:\PS> Register-BEEvent -Event AlertChanged -Action { $voice.Speak($EventArgs.Alert.Message, 1) }

This command subscribes to events generated when a Backup Exec alert is added and uses the Windows Speech API to read the alert message out loud.