Created
February 23, 2022 12:25
-
-
Save marcohald/2bc09e9a6fda3f3095bc5f874a4c6e6c to your computer and use it in GitHub Desktop.
Parse the Logfile of Get-WindowsUpdateLog into a PsObject
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-WindowsUpdateLog | |
$lines = Get-Content "$([System.Environment]::GetFolderPath("Desktop"))\WindowsUpdate.log" | |
$parsed = $lines | ForEach-Object { | |
[PSCustomObject]@{ | |
'Timestamp' = $_.Substring(0,27) | |
'ProcessID' = $_.Substring(28,6).Trim() | |
'ThreadID' = $_.Substring(34,6).Trim() | |
'Task' = $_.Substring(40,15).Trim() | |
'Data' = $_.Substring(56) | |
} | |
} | |
$parsed | Out-GridView |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment