Menu & Search
Get-EventLog in PowerShell

Get-EventLog in PowerShell

The Get-EventLog cmdlet in PowerShell can help you view events as you would in Event Viewer, but within your PowerShell Terminal.

In this post I’ll share a few examples of use:

# Get List of Event Logs Available
# Show Events by Count
# Show Events by Message Name
# Show Full Message of an Event


Get List of Event Logs Available

#Get List of Event Logs Available
Get-EventLog -List

Show Events by Count

# Show Events by Count
Get-EventLog -LogName Application | Group-Object -Property Source -NoElement | Sort-Object -Property Count -Descending

Show Events by Message Name

# Show Events by Message Name
Get-EventLog -LogName Application -Newest 10 -Message *MSSQLSERVER*

Show Full Message of an Event

# Show Full Message of an Event
Get-EventLog -LogName Application -Newest 1 -Message *MSSQLSERVER* | Select Message

Share

0 Comments