Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 1.0 » Get-Eventlog

Get-Eventlog - Powershell 1.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 »

Get-Eventlog

Description
Get eventlog data

Usage


Options


Example(s)
Display the 50 most recent entries in the Application event log:

PS C:\>get-eventlog -newest 50 -logname application

Get the 100 recent entries from the System event log and store in $MyEvents.
Then pipeline the results to group-object to group them by event id.

PS C:\>$MyEvents = get-eventlog -logname system -newest 100
$events | group-object eventid

Write a new message to the Application eventlog:

PS C:\>$log = Get-EventLog -List | Where-Object { $_.Log -eq "Application" }
PS C:\>$log.Source = "Test"
PS C:\>$log.WriteEntry("Test message")

PS C:\>Get-EventLog Application -Newest 1 | Select Message