If you assign a static type to a variable, you can subscribe to static events.
For example:
$MyStaticType = [MyStaticNamespace.MyStaticClass] Register-ObjectEvent -InputObject $MyStaticType -EventName MyStaticEvent -Action {Write-Host "Caught a static event"}
To find any static events that a type can have, you can use Get-Member with the -Static switch
[MyStaticNamespace.MyStaticClass] | get-member -static -membertype event
EDIT: I noticed that when trying to access events [Microsoft.Win32.SystemEvents] I had to work in an advanced request (in Vista and above) in order to access the messages.
Steven murawski
source share