Param(
[string]$LogName = "System",
[string]$ComputerName = $env:COMPUTERNAME,
[int]$Newest = 500,
[string]$ReportTitle = "Event Log Report",
[Parameter(Mandatory,HelpMessage = "Enter the path for HTML")]
[string]$Path
)
$data = Get-EventLog -LogName System -EntryType Error -Newest $Newest -ComputerName $ComputerName |`
Group-Object -Property Source -NoElement
[string]$ComputerName = $env:COMPUTERNAME,
[int]$Newest = 500,
[string]$ReportTitle = "Event Log Report",
[Parameter(Mandatory,HelpMessage = "Enter the path for HTML")]
[string]$Path
)
$data = Get-EventLog -LogName System -EntryType Error -Newest $Newest -ComputerName $ComputerName |`
Group-Object -Property Source -NoElement
#Create an HTML report
$title = "System Log Analysis"
$footer = "<h5><i>Report Run $(get-date)</i></h5>"
$css = "https://jdhitsolutions.com/sample.css"
$precontent = "<h1>$ComputerName</h1><h2>Last $Newest error sources from $LogName</h2>"
$data | Sort-Object -Property count,name -Descending | select count,name | `
ConvertTo-Html -Title $title -PreContent $precontent -PostContent $footer -CssUri $css | Out-File "D:\Sumant\test.html"
No comments:
Post a Comment