i use the following powershell script to retrive all sql server error logs from event viewer and export as a html file to read easily from our web server.
that is the simpel version of the script that i published on the Microsoft Script Repository Site.
http://gallery.technet.microsoft.com/scriptcenter/bcdb30d6-b6ee-490f-ab8b-2e124c9159f4
$style = "<" + "style>" $style = $style + "TABLE{border:1px solid black; border-collapse: collapse;}" $style = $style + "TH{border:1px solid black;background-color:black;color:white;}" $style = $style + "TD{border:1px solid black;}" $style = $style + "</" + "style>" $logs = Get-EventLog Application | where {$_.Source -like "MSSQL*"} $logs = $logs | where {$_.EntryType -eq "Error"} $logs = $logs | Select-Object EventId,Message,Source,TimeGenerated $logs | ConvertTo-Html -head $style | Out-File "c:\logs.html"
Note = i splitted the style tags because of the code viewer 🙂