

Troubleshooting Tips to Fix Computer Automatic Restart Issue in WindowsĪutomatic restart in a Windows PC or laptop can be quickly fixed by altering a few settings and applying the following troubleshooting tips:Ĭhange Windows update settings to avoid computer restart automatically during your work hours. Change in registry values due to malware or virus infection.Other factors that cause a computer to restart automatically are: Hardware issues with RAM or hard disk or new hardware changes can also lead to automatic and random system shutdowns or restarts. Sometimes due to a conflict between the system files (including registry) or corrupt system files, the system starts to shut down abruptly that leads to automatic system restart and several other issues. Windows is a complex environment that is run by an intricate combination of several files. Still Cannot Fix the Computer Auto Restart Problem?.Troubleshooting Tips to Fix Computer Automatic Restart Issue in Windows.

I have yet to fully confirm the script actually executes at shutdown, that's my next step, but I believe it should. Setting all this is a pain but entirely possible using Chef, and after a converge, I see the script registered in gpedit.msc. This is for a PowerShell shutdown script located at C:\WINDOWS\System32\GroupPolicy\Machine\Scripts\Shutdown\seppuku.ps1. Those ending in \Shutdown\0\0 get script values: "Script"="C:\\WINDOWS\\System32\\GroupPolicy\\Machine\\Scripts\\Shutdown\\seppuku.ps1" "FileSysPath"="C:\\Windows\\System32\\GroupPolicy\\Machine" Those ending in \Shutdown\0 get policy values: "GPO-ID"="LocalGPO" HKLM\SOFTWARE\Policies\Microsoft\Windows\System\Scripts\Shutdown\0.HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Shutdown\0\0.HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Shutdown\0.HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Shutdown\0\0.HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Shutdown\0.I had to create C:\Windows\System32\GroupPolicy\Machine\Scripts\psscripts.ini: ĠCmdLine=C:\WINDOWS\System32\GroupPolicy\Machine\Scripts\Shutdown\seppuku.ps1 Thanks to insight from answer and from this answer to another question, I was able to get it working on Win2016. via PowerShell, DSC, or batch script) to register a GPO shutdown script on a machine not attached to AD without rebooting?

So, the question is: is there a way, via Chef (i.e. I'm aware of a possible use of Task Scheduler to run a script at shutdown, but (from my research at least) it seems that the key difference is that a task scheduler shutdown script only has as much time to run as the system takes to shutdown, whereas a GPO shutdown script will postpone shutdown until it finishes.
