Am trying to assess the reasons for unexpected server reboot. So I came up with script to track ASR events and BugCheck logs.
Below is the snippet of the code:
Get-WinEvent -ComputerName $Node -MaxEvents 2 -FilterHashtable@{Logname = "SYSTEM"; ProviderName = "BugCheck"; StartTime = $mytime} -ErrorAction Stop | Format-list -property TimeCreated, message | Outfile -Encoding string -Filepath $resultpath -Append
This works fine when I track ASR events by changing provider name to "ASR", but fails for "BugCheck".
I just need the time and message, from the bugcheck logged in the eventviewer.
Any help to fix this would be appreciated.
Thanks.