I have had this happen to me twice now. I'll be in the middle of working on something that has resulted in me not rebooting my machine for several days. If Windows 7 is waiting to install updates it'll eventually get to a point where it forces a restart to install the updates. The problem is that it doesn't notify me or tell me that its going to do this and I've lost work as a result and most recently had a VM become corrupt and unusable. Is there a way to at least get it to prompt me before doing this? It used to...
There is a registry setting you can add that will prevent this. Detailed instructions and a downloadable registry key can be found here: http://www.howtogeek.com/howto/windows-vista/prevent-windows-update-from-forcibly-rebooting-your-computer/
From the site:
I have used this registry hack successfully on many computers and I can't think of a single time it has forced a reboot on me. When critical updates are applied that will require a reboot, it does still pop up the "You need to restart" message near the system tray, but it does not reboot on its own.
Change your Windows updates settings to "Download updates but let me choose when to install them". Then it will tell you updates are ready and you pick when to install and reboot.
Go to Control Panel>Windows Update. Change it in the first dropdown box.
I just turned off the automatic updates like BroScience explained before. And now I use WuInstall to manage my Windows Updates. It has some nice options above all it lets you specify if you want a reboot or not.
Microsoft only forcibly reboot your machine after three days of the install being ready and you having continuously chosen not to install it. Additionally, the only updates that are mandatory installed by Windows Update are security updates. Unlike other companies, Microsoft does not push out feature updates (such as language packs etc) as mandatory updates (they are listed as "Optional" and Windows will not force you to reboot to install them).
Even worse - Windows Updates effectively tell attackers where the bugs are, because the patches can be reverse engineered. "Critical bugs" such as being able to buffer overflow system drivers remotely are massively dangerous, and you only have a short period of time after the update is made generally available before that bug will be known and being used "in the wild". Consequently disabling or choosing not to install Windows udpates is putting your machine at significant extra risk.
Perhaps a better response to your question is to look at it orthogonally; instead of "how can I turn the rebooting off", think "why does the reboot get in the way of my computer doing things?"
If you're using (or writing) a program that needs to do multi-day processing, consider very seriously whether a better approach is to regularly save "checkpoints" in order to allow resuming of the program. Doing so will not only allow your program to survive the reboot, but also mean that your work won't be lost if there's a power cut, if the program crashes and will probably make it easier to see how your program can be distributed over a number of other machines.
Once you've done this, you can schedule your program to run at boot by disabling the user login screen and putting a shortcut to your program in the "Startup" folder in your start menu, or via the Task Scheduler.
Once you've done this, Windows will be able to interrupt your task to install critical security updates, reboot your machine and then when your machine comes back online, the program can restart from the last checkpoint before the machine turned off.
In the limit case of you running a program that you don't control and hence can't force to checkpoint, consider installing it in a virtual machine with no networking. This way your host will be able to reboot (to protect your main computer) and this will cause the virtual machine to suspend. When you come back online your unpatched (but not network connected) virtual machine will be able to resume and your host machine will be protected.
Alternatively you can run the whole program on a laptop that's not plugged into the network at all. If you do this you'll not get any Windows Updates and you won't be indirectly connected to attackers who can exploit you, so the whole discussion becomes moot.
Finally, just because I know this will come up: This is not a theoretical risk. Small companies, individuals and academic organisations routinely lose critical data by cyber attack due to not patching their machines. DO NOT assume that being hacked only happens to people who are not like you. You really don't want to have to explain to your CEO, Dean or wife that all of your customer data, student records or banking documents are being sold on the Internet at $2 a piece because you "turned off Windows Update".