Hello =D,
I completely empathize with your frustration; losing 12 hours of work because the operating system prioritized an update over your active session is unacceptable in a professional workflow. The "Active Hours" feature mentioned by the AI is useful for general usage, but it has a hard cap (usually 18 hours), meaning that long-running tasks like rendering or compiling data overnight will often fall outside that window and trigger a reboot. To strictly prevent this behavior without disabling updates entirely, you need to configure a specific policy that forbids the system from restarting as long as a user is logged on.
If you are using Windows 10 or 11 Pro, you can enforce this via the Group Policy Editor. Press the Windows key + R, type gpedit.msc, and press Enter. Navigate through Computer Configuration > Administrative Templates > Windows Components > Windows Update. Depending on your specific Windows build, you will find the necessary setting either directly in this folder or inside a sub-folder named "Manage end user experience." Locate the policy titled "No auto-restart with logged on users for scheduled automatic updates installations." Double-click this policy, set it to Enabled, and click Apply. This forces the Windows Update service to download and install patches but inhibits the automatic restart phase indefinitely as long as your user session is active.
For Windows Home users who lack the Group Policy Editor, you can apply the same restriction via the Registry. Open the Registry Editor by typing regedit in the Start menu. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU. If the keys WindowsUpdate or AU do not exist, you will need to create them manually by right-clicking the parent folder and selecting New > Key. Once inside the AU key, create a new DWORD (32-bit) Value named NoAutoRebootWithLoggedOnUsers and set its value data to 1. You will need to restart the machine once manually for this policy to take effect. From that point on, Windows will notify you that a restart is pending, but it will not execute it until you manually choose to do so.
I hope you've found something useful here. If it helps you get more insight into the issue, it's appreciated to accept the answer. Should you have more questions, feel free to leave a message. Happy new year!
VP