Get the events in the PowerShell event queue for the current session.

      Get-Event [-EventIdentifier] int [CommonParameters]

      Get-Event [[-SourceIdentifier] string] [CommonParameters]

   -EventIdentifier int
       Get only the events with the specified event identifier.

   -SourceIdentifier string
       Get only events with the specified source identifier.
       The default is all events in the event queue.
       Wildcards are not permitted.

       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
       -OutBuffer -OutVariable.

When an event occurs, it is added to the PowerShell event queue. The event queue includes events for which you have registered, events created by using the New-Event cmdlet, and the event that is raised when Windows PowerShell exits. You can use Get-Event or Wait-Event to get the events.

This cmdlet does not get events from the Event Viewer logs. To get those events, use Get-WinEvent or Get-Eventlog.


Get all events in the event queue:

PS C:\> get-event

Get events in which the value of the SourceIdentifier property is "PowerShell.ProcessCreated".

PS C:\> get-event -sourceIdentifier "PowerShell.ProcessCreated"

Get events with specific properties:

PS C:\> $events = get-event
PS C:\> $events[0] | format-list -property *
PS C:\> get-event | where {$_.TimeGenerated -ge "11/13/2008 12:15:00 PM"}

“The Statesman who yields to war fever must realize that once the signal is given, he is no longer the master of policy but the slave of unforeseeable and uncontrollable events” ~ Sir Winston Spencer Churchill


New-Event - Create a new event
Remove-Event - Delete events from the event queue
Get-WinEvent - Get events from event logs and event trace logs
Get-Eventlog - Get event log data

Copyright © 1999-2017
Some rights reserved