Contact Info

Crumbtrail » Administration » Powershell » Powershell 3.0 » Register-WmiEvent

Register-WmiEvent - 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 a Windows Management Instrumentation (WMI) event.

Register-WmiEvent [-Class] <String> [[-SourceIdentifier] <String>] [[-Action] <ScriptBlock>] [-ComputerName <String>] [
-Credential <PSCredential>] [-Forward] [-MaxTriggerCount <Int32>] [-MessageData <PSObject>] [-Namespace <String>] [-Sup
portEvent] [-Timeout <Int64>] [<CommonParameters>]
Register-WmiEvent [-Query] <String> [[-SourceIdentifier] <String>] [[-Action] <ScriptBlock>] [-ComputerName <String>] [
-Credential <PSCredential>] [-Forward] [-MaxTriggerCount <Int32>] [-MessageData <PSObject>] [-Namespace <String>] [-Sup
portEvent] [-Timeout <Int64>] [<CommonParameters>]

The Register-WmiEvent cmdlet subscribes to WMI events on the local computer or on a remote computer.

When the subscribed WMI event is raised, it is added to the event queue in your local session even if the event occurs 
on a remote computer. To get events in the event queue, use the Get-Event cmdlet.

You can use the parameters of Register-WmiEvent to subscribe to events on remote computers and to specify the property 
values of the events that can help you to identify the event in the queue. You can also use the Action parameter to spe
cify actions to take when a subscribed event is raised.

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

New CIM cmdlets, introduced Windows PowerShell 3.0, perform the same tasks as the WMI cmdlets. The CIM cmdlets comply w
ith WS-Management (WSMan) standards and with the Common Information Model (CIM) standard, which enables the cmdlets to 
use the same techniques to manage Windows computers and those running other operating systems. Instead of using Registe
r-WmiEvent, consider using the Register-CimIndicationEvent cmdlet.