BRONZE PARTNER:
BRONZE PARTNER:
Industry News:

| |
 |
 |
 |
| PowerShell script to check remote eventlog |
 |
|
|
By: Ying Li
Posted On: 9/26/2007
Here is a PowerShell script to check remote eventlog:
This article was Previously posted on Ying Li's Blog
$strcomputer = Read-Host "Please Enter the Server Name" $source = Read-Host "Please Enter the Event Source" $Evelog = new-object system.diagnostics.eventlog("$source", "$strComputer") $Evelog.entries |Where {$_.EventID -eq "xxxx"}|format-table Index,Timegenerated, EventID, Message, Username
From here on, your imagination is the limit – You can query, filter and format the data...
For example, if you want to find out how many times a server was rebooted, you can do the following:
$Evelog.entries | where {$_.message | select-string -pattern "Reboot" }
|
 |
 |
 |
|
|