Get the event subscribers in the current session.
Syntax
Get-EventSubscriber [-SubscriptionId] int
[[-Force]] [CommonParameters]
Get-EventSubscriber [[-SourceIdentifier] string]
[[-Force]] [CommonParameters]
Key:
-Force
Get all event subscribers, including subscribers for events that
are hidden using Register-ObjectEvent -SupportEvent, Register-WmiEvent or Register-EngineEvent.
-SourceIdentifier string
Get only the event subscribers with the specified property value.
The default is all event subscribers in the session.
Wildcards are not permitted. This parameter is case-sensitive.
-SubscriptionId int
Get only the specified subscription identifier.
The default is all event subscribers in the session.
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
-OutBuffer -OutVariable.
Event logs often contain tens of thousands of event log entries, so consider using -Newest parameter to limit the number of entries returned.
Examples
Get the event subscriber for an elapsed event:
PS C:\> Get-EventSubscriber
Get the event subscriber of the Timer.Random event.
PS C:\> $subscriber = Get-EventSubcriber -sourceIdentifer Timer.Random
Display the Action property of the event subscriber object:
PS C:\> ($subscriber.action).gettype().fullname
“History is the version of past events that people have decided to agree upon” ~ Napoleon Bonaparte
Related PowerShell Cmdlets:
Get-WinEvent - Get events from event logs and event trace logs.
Get-Event - Get events in the event queue.