Jump to content
Microsoft Windows Bulletin Board

Vista Updates and Shutdown


Recommended Posts

Guest Mike
Posted

Is there a way to be able to install updates and reboot vs. the default of

shutdown. It's quite a PIA to have to shut down your machine in order to get

updates installed - XP doesn't do this.

 

Before we consider deploying this corporate wide - this is not a good

solution and will delay us in our plans for deploying Vista.

 

Thank you,

 

Mike

  • 3 weeks later...
Posted

Mike, I've been trying to find out if there is a registry hack or some method

of change it to "Install updates and Reboot" vs. the "Install updates and

Shutdown". I've found nothing after several days of looking. I don't

understand why shutdown is the only options.

 

I saw a post like yours back in 2004 so this isn't a new issues, but

Microsoft doesn't seem to agree with us. What would be the harm in providing

us the user the choice??

 

- Mark

 

"Mike" wrote:

> Is there a way to be able to install updates and reboot vs. the default of

> shutdown. It's quite a PIA to have to shut down your machine in order to get

> updates installed - XP doesn't do this.

>

> Before we consider deploying this corporate wide - this is not a good

> solution and will delay us in our plans for deploying Vista.

>

> Thank you,

>

> Mike

Guest Lawrence Garvin \(MVP\)
Posted

"Mark" <Mark@discussions.microsoft.com> wrote in message

news:96B2C47E-3C44-475D-AB27-5EB28A8C1BDE@microsoft.com...

> Mike, I've been trying to find out if there is a registry hack or some

> method

> of change it to "Install updates and Reboot" vs. the "Install updates and

> Shutdown". I've found nothing after several days of looking. I don't

> understand why shutdown is the only options.

 

There is *no* such hack or option.

 

The functionality is hardcoded to be Install/Shutdown, and that's the only

flavor it comes in.

>> Is there a way to be able to install updates and reboot vs. the default

>> of

>> shutdown. It's quite a PIA to have to shut down your machine in order to

>> get

>> updates installed - XP doesn't do this.

 

Uh.. this is not the *only* way to install updates.

 

If you install updates via the *scheduled* installation event, the system

will REBOOT.

 

 

 

--

Lawrence Garvin, M.S., MCTS, MCP

Independent WSUS Evangelist

MVP-Software Distribution (2005-2007)

https://mvp.support.microsoft.com/profile=30E00990-8F1D-4774-BD62-D095EB07B36E

 

Everything you need for WSUS is at

http://www.microsoft.com/wsus

 

And, almost everything else is at

http://wsusinfo.onsitechsolutions.com

.....

Posted

"Lawrence Garvin (MVP)" wrote:

 

Uh... I know that. It is scheduled to install them at 3:00 AM and it will

reboot if needed, but there are times you want to install them sooner via the

"Install Updates and Shut Down". But there isn't a way, that's I've found, to

do an "Install Update and Reboot". I don't understand why this would be such

a big deal. There are times when people need this.

> Uh.. this is not the *only* way to install updates.

>

> If you install updates via the *scheduled* installation event, the system

> will REBOOT.

>

>

>

> --

> Lawrence Garvin, M.S., MCTS, MCP

> Independent WSUS Evangelist

> MVP-Software Distribution (2005-2007)

> https://mvp.support.microsoft.com/profile=30E00990-8F1D-4774-BD62-D095EB07B36E

>

> Everything you need for WSUS is at

> http://www.microsoft.com/wsus

>

> And, almost everything else is at

> http://wsusinfo.onsitechsolutions.com

> .....

>

>

>

Guest Harry Johnston
Posted

Mark wrote:

> Mike, I've been trying to find out if there is a registry hack or some method

> of change it to "Install updates and Reboot" vs. the "Install updates and

> Shutdown". I've found nothing after several days of looking.

 

There may be a way to force the system to reboot rather than shutting down, by

running a program that waits for the shutdown to begin and issues a request for

a reboot. Of course, this wouldn't change the text in the dialog box.

 

I'm working from home at the moment and can't try it out, but I'll give it a go

sometime in the coming week, time permitting, and report back.

 

Harry.

Guest Harry Johnston
Posted

I wrote:

>> Mike, I've been trying to find out if there is a registry hack or some

>> method of change it to "Install updates and Reboot" vs. the "Install

>> updates and Shutdown". I've found nothing after several days of looking.

>

> There may be a way to force the system to reboot rather than shutting

> down, by running a program that waits for the shutdown to begin and

> issues a request for a reboot. Of course, this wouldn't change the text

> in the dialog box.

 

It kind of works. The problem is that if you wait for the shutdown signal it's

too late to change it to a reboot, but if you issue the reboot immediately after

seeing the logout signal the updates don't install.

 

This code issues a reboot five seconds after seeing the logout signal. If the

logout doesn't take too long, and the updates don't finish too quickly, it

works. Ideally it should wait for some indication that the updates have

started, e.g., by parsing WindowsUpdate.log, or looking at the text controls on

the dialog boxes on the Winlogon desktop there may be better ways.

 

You have to run this code using psexec (http://www.sysinternals.com) and the -s flag

because if you run it in the interactive logon session it'll be forced to exit

when you log off. If you want to see status and error messages you'll need to

run it using psexec from a remote system. If you want to run it from the local

system, you'll need the -d flag as well as -s so that the local end of psexec

doesn't get terminated when you log off. Ideally it should probably be a system

service, or perhaps a Winlogon customization.

 

I'm placing this code, such as it is, in the public domain. Anybody that wants

to turn it into something workable is welcome to start here.

 

#define _WIN32_WINNT 0x0501

 

#include <windows.h>

 

#include <stdio.h>

 

HANDLE go

 

BOOL WINAPI ConsoleCtrlHandler(DWORD dwCtrlType)

{

DWORD err

 

if (dwCtrlType == CTRL_LOGOFF_EVENT)

{

 

if (!SetEvent(go))

{

err = GetLastError()

printf("SetEvent: %u\n", err)

ExitProcess(err)

}

 

printf("Logoff event detected.\n")

return TRUE

 

}

 

printf("dwCtrlType %u\n", dwCtrlType)

return TRUE

}

 

int main(int argc, char * argv)

{

DWORD err, dw

 

HANDLE hToken

 

TOKEN_PRIVILEGES tkp

 

if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES |

TOKEN_QUERY, &hToken))

{

err = GetLastError()

printf("OpenProcessToken: %u\n", err)

return err

}

 

if (!LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid))

{

err = GetLastError()

printf("LookupPrivilegeValue: %u\n", err)

return err

}

 

tkp.PrivilegeCount = 1 // one privilege to set

tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED

 

if (!AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0))

{

err = GetLastError()

printf("AdjustTokenPrivileges: %u\n", err)

return err

}

 

go = CreateEvent(NULL, FALSE, FALSE, NULL)

if (go == NULL)

{

err = GetLastError()

printf("CreateEvent: %u\n", err)

return err

}

 

if (!SetConsoleCtrlHandler(ConsoleCtrlHandler, TRUE))

{

err = GetLastError()

printf("Error %u calling SetConsoleCtrlHandler.\n", err)

return err

}

 

printf("SetConsoleCtrlHandler call successful.\n")

 

dw = WaitForSingleObject(go, INFINITE)

if (dw == WAIT_FAILED)

{

err = GetLastError()

printf("WaitForSingleObject: %u\n", err)

return err

}

 

Sleep(5000)

 

if (!ExitWindowsEx(EWX_REBOOT, SHTDN_REASON_MAJOR_SOFTWARE |

SHTDN_REASON_FLAG_PLANNED))

{

err = GetLastError()

printf("Error %u calling ExitWindowsEx.\n", err)

return err

}

 

printf("Call to ExitWindowsEx successful.\n")

return 0

 

}

×
×
  • Create New...