Home » Questions » Computers [ Ask a new question ]

A way to prevent Windows Update from restarting the computer?

A way to prevent Windows Update from restarting the computer?

I'm looking for a way to prevent Windows from restarting/installing updates while my program is running.

Asked by: Guest | Views: 258
Total answers/comments: 4
Guest [Entry]

"You need to use a different registry setting for this:

HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU

Then set this to 1:

NoAutoRebootWithLoggedOnUsers

I've also put together a downloadable registry patch for this one if you want that instead."
Guest [Entry]

"I don't know if this is a windows forms app or not, but you can cancel a shutdown in the FormClosing event handler of a windows forms app thusly:

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.WindowsShutDown)
{
e.Cancel = true;
}
}

It's possible a windows update will override this, but a normal user shutdown will be prevented by this code (at least in XP)."
Guest [Entry]

"It's not a good solution, but a possible one: just kill/stop the service.

You might also (at least this works on Windows XP) change the policy settings using the gpedit.msc panel. Don't know if editing the group policies can be done programatically as well."
Guest [Entry]

"Run this process to stop Windows Update completely (at your own peril):

sc.exe stop wuauserv"