#247 Reboot instruction on Server 2012 R2


While testing on Windows Server 2012 R2 I found that ExitWindowsEx (the Reboot instruction) does not actually reboot the machine if the installer was launched from a domain user. This is the case even if the original user was a domain administrator and the installer was elevated as a local administrator. The installer has the Windows 8.1 supported OS GUID embedded in its XML manifest and this has no effect.

The only situation where ExitWindowsEx reboots correctly is when the original logged in user is a local administrator. In every other case, the machine appears to do a quick reboot without a full power cycle. This means that operations that require a full reboot cycle never occur - such as replace on reboot operations (/rebootok).

The fix is to use the newer InitiateSystemShutdownEx API. I could not find anything about this on MSDN.

I have included a patch for NSIS 3.0a2 which calls InitiateSystemShutdownEx instead of ExitWindowsEx if it is available (uses myGetProcAddress). I have tested the Reboot instruction with the new code on Windows XP x86, Windows Vista x86, Windows Vista x64, Windows 7 x86, Windows 7 x64, Windows 8 x86, Windows 8 x64, Windows Server 2012 R2 x64.

1 Attachments


  • Stuart

    Stuart - 2014-05-17

    I just tried the following, which also works:


    As Anders has pointed out,

    I guess the only reason to use this is that the name is shorter and it is Vista+ only so it would never mess up NT5.


  • Amir Szekely

    Amir Szekely - 2014-05-18



    And from MSDN page on ExitWindowsEx:

    "The ExitWindowsEx function returns as soon as it has initiated the shutdown process. The shutdown or logoff then proceeds asynchronously. The function is designed to stop all processes in the caller's logon session. Therefore, if you are not the interactive user, the function can succeed without actually shutting down the computer. If you are not the interactive user, use the InitiateSystemShutdown orInitiateSystemShutdownEx function."

  • Stuart

    Stuart - 2014-05-31

    Here is a new patch for 3.0b0 which uses InitiateShutdown instead of InitiateSystemShutdownEx. I haven't built with it yet but I will try to find time soon (need to set up a VM).


  • Anders

    Anders - 2014-06-27
    • status: open --> closed-accepted

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks