How to Search EventLog Using PowerShell

In this post I will show you some tips on how you can search your computers EventLog using PowerShell.

This can be very powerful if you need to search for e.g. a specifik error in the EventLog. 

Basic Get-EventLog command

The basic command is like shown below.

Get-EventLog -LogName System

If you want to you can filter using the parameter -EntryType to see only e.g. Errors in the eventlog:

Get-EventLog -LogName System -EntryType Error

In order to only see the newest 10 error you can enter the command below:

Get-EventLog -LogName System -EntryType Error -Newest 10

Run Get-EventLog on Remote computer

In order to check the EventLog on a remote computer you will have to use the Invoke command as shown below:


All you need to do is to replace localhost with the name of the remote computer, where you want to run the command.

For more information about the PowerShell Get-EventLog cmd-let check out Microsoft docs



Comments

Popular posts from this blog

Use PowerShell to Discover Network Switch and port number

How to get Public IP Using PowerShell

Use ChatGPT to write PowerShell Scripts