0

We created an Inno Setup script to install and update a Windows service. The same installer can be used manually or from an automatic installation/update solution.

When using the installer to update an existing installation, the setup correctly terminates the running service process before updating it. This service relies on Windows Restart Manager to be automatically restarted and Inno Setup is able to restart it after the installation completes.

In some occasions, some files deployed with the installer cannot be updated on the fly as they require a Windows restart to complete. We decided to NOT force the system restart and kindly prompt the user to reboot as soon as possible. Everything works as expected, except that Inno Setup cancels the service restart because of a pending Windows reboot, even if there are no direct process dependencies that needs to be updated after the reboot.

From Inno Setup Log:

Need to restart Windows, not attempting to restart applications

While this may have a logic, the fact that the service is not automatically restarted represent an issue in our scenario that forces the user to reboot immediately, which is not what we want.

This is the command line arguments: /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /RESTARTEXITCODE=123456 /RESTARTAPPLICATIONS

This is part of the installation log: enter image description here

The /RESTARTAPPLICATIONS command line flag has no effect on this behavior, as the service application is correctly restarted regardless of that flag presence, whenever there is no reboot pending.

A solution may be to call an external script in the Run section or use Pascal code to restart the service, but we would like to avoid it if possible.

Are we missing something? Is there a way to have the service restart to always succeed even if there is a pending reboot?

Alex B.
  • 43
  • 1
  • 5
  • 1
    It's as it is. When Inno Setup believes that restart is needed, it does not let the restart manager to restart the applications. The workaround is to avoid Inno Setup detecting the needs to restart or to restart the service on your own (as you know). – Martin Prikryl Feb 18 '21 at 10:27
  • I am not sure I understand. If IS could not replace files due to the need to restart, it makes sense not to restart the service because a reboot is needed anyway. But as Martin noted, if you want to restart the service anyway, you would need to do this separately from the Restart Manager. – Bill_Stewart Feb 19 '21 at 00:05
  • @Bill_Stewart These files has nothing to do with most of the service functionalities (no dependencies), but Inno Setup assumes anyway that the service should not be restarted since the procedure is not completed. So a question could be: why does I.S. decide to NOT restart the service even if it does not depend on any file to be updated after the reboot? In my opinion, this goes in the wrong direction if compared to what Microsoft says about the introduction of Restart Manager to reduce the number of system reboots. – Alex B. Feb 19 '21 at 13:50
  • *"why does I.S. decide to NOT restart the service even if it does not depend on any file to be updated after the reboot?"* – That's not the kind of questions we answer on Stack Overflow. – Martin Prikryl Feb 19 '21 at 13:55
  • I would assume (but this is just a guess) that because IS has determined that a reboot is required, what would be the point of restarting the service since you need to reboot anyway? – Bill_Stewart Feb 19 '21 at 14:25
  • @MartinPrikryl My fault. This was a rhetorical question (in some way) that could help me to better focus how IS works. – Alex B. Feb 22 '21 at 10:58

0 Answers0