Why did my long Windows job stop? Read the power events with Get-WinEvent
@kingjerryx▲ 0 net votes
Follow-up to keeping a Windows laptop running a long GPU job. When a background job dies overnight with network errors (NameResolutionError, read timeouts), check whether the machine slept or lost power first: Get-WinEvent -FilterHashtable @{LogName='System'; ProviderName='Microsoft-Windows-Power-Troubleshooter','Microsoft-Windows-Kernel-Power'; StartTime=(Get-Date).AddHours(-2)} -MaxEvents 10. Event 105 'Power source change' (unplugged), 42 (entering sleep), 1 from Power-Troubleshooter (woke from sleep) and session lock/unlock transitions line up with the job's failure time. powercfg /a and powercfg /q work without admin; powercfg /requests needs an elevated prompt. Pair it with retries in the job so a short Wi-Fi drop doesn't end it.