forked from sagarv26/powershell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGet-WinEventWithHTML.ps1
More file actions
16 lines (11 loc) · 965 Bytes
/
Get-WinEventWithHTML.ps1
File metadata and controls
16 lines (11 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
### CSS style
$css= "<style>"
$css= $css+ "BODY{ text-align: center; background-color:white;}"
$css= $css+ "TABLE{ font-family: 'Lucida Sans Unicode', 'Lucida Grande', Sans-Serif;font-size: 12px;margin: 10px;width: 100%;text-align: center;border-collapse: collapse;border-top: 7px solid #004466;border-bottom: 7px solid #004466;}"
$css= $css+ "TH{font-size: 13px;font-weight: normal;padding: 1px;background: #cceeff;border-right: 1px solid #004466;border-left: 1px solid #004466;color: #004466;}"
$css= $css+ "TD{padding: 1px;background: #e5f7ff;border-right: 1px solid #004466;border-left: 1px solid #004466;color: #669;hover:black;}"
$css= $css+ "TD:hover{ background-color:#004466;}"
$css= $css+ "</style>"
$StartDate = (get-date).adddays(-1)
$body = Get-WinEvent -FilterHashtable @{logname="Application"; starttime=$StartDate} -ErrorAction SilentlyContinue
$body | ConvertTo-HTML -Head $css MachineName,ID,TimeCreated,Message > C:\LogAppView.html