Posts

Showing posts from December, 2019

ConvertTo-Html in Powershell

# This PowerShell script gives information about the events of ERROR,CRITICAL and WARNING, and this provides today data alone.     cls $Computername = $env:COMPUTERNAME   $a = get-date $month = $a . tostring( "MM" ) $day = $a . tostring( "dd" ) $year = $a . tostring( "yyyy" ) $OutFile = "D:\ServerList\" + $Computername + "_Error_Warning_Critical.html" $csname = $Computername + "_Warning_Error_Critical" Get-WinEvent ` -LogName Application , System | Select-Object @{Name = "Service" ;expression = { $_ . ProviderName}} , TimeCreated , Id , @{Name = "Level" ;expression = { $_ . LevelDisplayName}} , Message | Where-Object {(( $_ . Level -eq 'warning' ) -or ( $_ . Level -eq 'Error' ) -or ( $_ . Level -eq 'Critical' )) -and ( $_ . Timecreated -like "* $month / $day / $year...