I have created a setup using Inno Setup 6.0.3 which requries to automatically restart Windows 2019 Server at the end.
However if the UAC setting are set as follows -
User Account Control Setting: Notify me only when apps try to make changes to my computer (default)
And the user starts the setup by double clicking on the setup file in Windows explorer and then chooses "Yes, restart the computer now" then I get the following error -
"Setup was unable to restart the computer. Please do this manually"
I have include the required [Setup] directives PrivilegesRequired and AlwaysRestart
[Setup]
PrivilegesRequired=admin
ChangesEnvironment=yes
AppName={#MyAppName}
AppVersion={#MyAppVersion}
DefaultDirName=test\MyProduct
AlwaysRestart=yes
The setup log does show that Inno setups code to restart Windows is called.
2019-11-25 01:28:22.755 Process exit code: 1
2019-11-25 01:28:22.976 Need to restart Windows? Yes
2019-11-25 01:28:25.083 Deinitializing Setup.
2019-11-25 01:28:25.087 Restarting Windows.
2019-11-25 01:28:25.098 Log closed.
However the API ExitWindows fails since inno setup failed to elevate permission hence Windows does not start and the above mentioned error message is shown.
Note:
- Also if I explicilty run the setup by right click "Run as admin" then the automatic works fine.
- If UAC is turned off i.e set to "Never notify..." then auto restart works even when user starts the setup by double clicking on the setup file in Windows explore.
Is this a known issue OR am I missing something in the [Setup] directives?