Display Events with a particular Text

Supply the required text as parameter to display all events that contain the text.

Script

<#
.SYNOPSIS
This powershell script can be used to display events with a particular text.
.DESCRIPTION
This script can be used to display events with a particular text.
.EXAMPLE
C:\PS> C:\Script\Event_Log_Text.ps1 Bluetooth
Displays events containing bluetooth in its message.
#>
#Check if the event’s message matches with the given word.

param([String] $word)
Get-EventLog System | Where-Object { $_.Message -match $word }

 

Output
Events

Leave a Reply