Read a remote log, out put the log to your screen

 
Works rather well, but it takes a moment to read in the log and parse it.
This one asks for your domain credentials and goes back 7 days.
 
$Credentials=Get-Credential("domainusername")
$d = Get-Date -displayhint date
$FQDNservername="your server"
$A = Get-WmiObject win32_NTLogEvent –computerName $FQDNservername -credential $Credentials -filter "logfile = ‘application’ and eventcode = 1"
Write-Host "Application event log acquired for Server $FQDNservername"  -backgroundcolor green -foregroundcolor black
$BeginDate=[System.Management.ManagementDateTimeConverter]::ToDMTFDateTime($d.AddDays(-7))
$results = $A | select TimeGenerated,Message
$results
Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s