Exit Posted June 16, 2019 Share Posted June 16, 2019 (edited) Yes, it caught me again tonight. While a VHS tape has been copied to the hard disk, after 3.5 hours (30 minutes before the end) Windows has automatically rebooted after an update. That although activity was present. Thanks Micro scrap. Now I've created this script so it never happens again. Maybe it will help you too. Thanks to @argumentum for this new version. ; Switch off AutoReboot after Windows update ; Author: Exit ( http://www.autoitscript.com/forum/user/45639-exit ) ; Windows Registry Editor Version 5.00 ; [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU] ; "NoAutoRebootWithLoggedOnUsers"=dword:00000001 #RequireAdmin ; otherwise error 1 Local Const $sRegkeyname = "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" Local Const $sRegValuename = "NoAutoRebootWithLoggedOnUsers" Local $iAutoReboot = RegRead($sRegkeyname, $sRegValuename) Switch @error Case 0 Case 1, 2, -1 $iAutoReboot = 0 Case Else Exit MsgBox(64 + 262144, Default, "Error " & @error & " reading registry.", 0) EndSwitch If $iAutoReboot = 1 Then MsgBox(64 + 262144, Default, $sRegValuename & " switch was already ON." & @LF & @LF & "No further action required.", 0) Else Local $rc = RegWrite($sRegkeyname, $sRegValuename, "REG_DWORD", 1) If @error Then Exit MsgBox(64 + 262144, Default, "Error " & @error & " writing registry." & @LF & @LF & "#RequireAdmin missing?", 0) MsgBox(64 + 262144, Default, "NoAutoRebootWithLoggedOnUsers switch set ON." & @LF & @LF & "No AutoReboot will occour while you are logged on.", 0) EndIf Previous code in Spoiler. Spoiler ; Switch off AutoReboot after Windows update ; Author: Exit ( http://www.autoitscript.com/forum/user/45639-exit ) ; Windows Registry Editor Version 5.00 ; [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU] ; "NoAutoRebootWithLoggedOnUsers"=dword:00000001 #RequireAdmin ; otherwise error 1 Local Const $sRegkeyname = "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" Local Const $sRegValuename = "NoAutoRebootWithLoggedOnUsers" Local $iAutoReboot = RegRead($sRegkeyname, $sRegValuename) If @error Then Exit MsgBox(64 + 262144, Default, "Error reading registry.", 0) If $iAutoReboot = 1 Then MsgBox(64 + 262144, Default, $sRegValuename & " switch was already ON." & @LF & @LF & "No further action required.", 0) Else Local $rc = RegWrite($sRegkeyname, $sRegValuename, "REG_DWORD", 1) If @error Then Exit MsgBox(64 + 262144, Default, "Error " & @error & " writing registry." & @LF & @LF & "#RequireAdmin missing?", 0) MsgBox(64 + 262144, Default, "NoAutoRebootWithLoggedOnUsers switch set ON." & @LF & @LF & "No AutoReboot will occour while you are logged on.", 0) EndIf Edited June 16, 2019 by Exit TheDcoder, argumentum and coffeeturtle 2 1 App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
argumentum Posted June 16, 2019 Share Posted June 16, 2019 (edited) Edited June 16, 2019 by argumentum =) Exit 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Exit Posted June 16, 2019 Author Share Posted June 16, 2019 @argumentum Good catch! Mending will follow soon. argumentum 1 App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
Exit Posted June 16, 2019 Author Share Posted June 16, 2019 The work is done. See changes in the first post. argumentum 1 App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
TheDcoder Posted June 17, 2019 Share Posted June 17, 2019 Wish I knew about this when I was using Windows... I am sure some will find this very useful My story is about the same, but it was a long game installation instead of copying. I had to wipe the existing install (because I was away and not sure if it was installed properly) and do it again, fun times. Exit 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now