|
$Servers = "yourcomputer1",'"yourcomputer2"
try
{
$Arr1 = Get-EventLog System -Entrytype Error -computer $Servers -After (Get-Date).AddDays(-1) | select MachineName,EventID,TimeGenerated,EntryType,Message,Source | ConvertTo-HTML -Fragment
}
catch [System.InvalidOperationException]
{
Write-Host "Uh uh, a error occured"
}
finally
{
#$CSS = get-content c:\style.css
$head1 = "Application Event Logs for Errors$CSS"
ConvertTo-HTML -Body "$Arr1" -head $head1 | Out-File d:\System_Event_Logs.html
}
|
|
|