# accessing excel via COM $excel = New-Object-ComObject Excel.Application # make it visible (for debugging only, can be set to $false later in production) $excel.Visible = $true
$PathHTML = "$env:temp\report.htm" $html | Set-Content$PathHTML-Encoding UTF8 # open as HTML Invoke-Item-Path$PathHTML # open as Excel report Start-Process-FilePath excel -ArgumentList"""$PathHTML"""
# make sure the property gets piped to Out-String to turn its # content into readable text that can be displayed in the report $replacementStrings = @{ Name = 'ReplacementStrings' Expression = { ($_.ReplacementStrings | Out-String).Trim() } }
Get-EventLog-LogName System -EntryType Error -After$startDate | # select the properties to be included in your report Select-Object-Property EventId, Message, Source, InstanceId, TimeGenerated, $ReplacementStrings, UserName | ConvertTo-Html | Set-Content-Path$Path
# make sure the property gets piped to Out-String to turn its # content into readable text that can be displayed in the report $replacementStrings = @{ Name = 'ReplacementStrings' Expression = { $_.ReplacementStrings -join',' } }
Get-EventLog-LogName System -EntryType Error -After$startDate | # select the properties to be included in your report Select-Object-Property EventId, Message, Source, InstanceId, TimeGenerated, $ReplacementStrings, UserName | ConvertTo-Html | Set-Content-Path$Path
Get-EventLog-LogName System -EntryType Error -After$startDate | # select the properties to be included in your report Select-Object-Property EventId, Message, Source, InstanceId, TimeGenerated, ReplacementStrings, UserName | ConvertTo-Html | Set-Content-Path$Path
Title Operation Date ------------------ Definitionsupdate für Windows Defender – KB2267602 (Definition 1.249.348.0) Installation 28.07.20... Definitionsupdate für Windows Defender – KB2267602 (Definition 1.249.281.0) Installation 27.07.20... Definitionsupdate für Windows Defender – KB2267602 (Definition 1.249.237.0) Installation 26.07.20... Definitionsupdate für Windows Defender – KB2267602 (Definition 1.249.191.0) Installation 25.07.20... Definitionsupdate für Windows Defender – KB2267602 (Definition 1.249.139.0) Installation 24.07.20... Definitionsupdate für Windows Defender – KB2267602 (Definition 1.249.95.0) Installation 22.07.20... Definitionsupdate für Windows Defender – KB2267602 (Definition 1.249.93.0) Installation 22.07.20... Definitionsupdate für Windows Defender – KB2267602 (Definition 1.249.28.0) Installation 21.07.20... Definitionsupdate für Windows Defender – KB2267602 (Definition 1.249.13.0) Installation 20.07.20... Definitionsupdate für Windows Defender – KB2267602 (Definition 1.247.1068.0) Installation 19.07.20... Definitionsupdate für Windows Defender – KB2267602 (Definition 1.247.1010.0) Installation 18.07.20... Definitionsupdate für Windows Defender – KB2267602 (Definition 1.247.969.0) Installation 17.07.20... Definitionsupdate für Windows Defender – KB2267602 (Definition 1.247.966.0) Installation 17.07.20...