Inno Setup does not restart services if there is a pending Windows reboot

388 views Asked by At

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?

0

There are 0 answers