PowerShell: Find a Specific Event ID


We have a bunch Windows servers having the notorious 333 error issue periodically. To catch this error as soon as possible, I wrote a script and added it into schedule tasks.

$Servers = Get-Content servers_list.txt
Foreach ($Server in $Servers)
{
Write-Host -backgroundcolor yellow **************$Server*********************
Get-EventLog -ComputerName $Server -LogName System -After (Get-Date).date | Where-Object {$_.EventID -eq 333} | Get-Unique
}

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s