Inno Setup: Post Install Program Launches, installer still "active" - installation

I'm currently attempting to create a installer script in Inno Setup, and pretty much have all the functionality I need in it. The one issue I'm running into is with the following line of code:
[Run]
Filename: "{sd}\my_file\something\bin\Program.exe"; Flags: postinstall unchecked;
Now, it does do the intended behavior of allowing me the option of launching the software, with the checkbox defaulting to unchecked. No issue there. What is happening is that when I check the box to launch "Program.exe" after the installation is finished, the program opens, but the installer is not killed. At the moment, "Program.exe" is up and running, but the installer application/process is still on the task bar (I'm running Windows 10 Professional in a VM) and in the Task Manager. However, upon killing the program that launches upon completing the install, the installer is killed as well. I'll include the [UninstallDelete] section below just so you can all see how I'm trying to end the installer:
[UninstallDelete]
Type: filesandordirs; Name: "{app}";
Type: filesandordirs; Name: "{sd}\customdir";
Additionally, I'm using UseRelativePaths=True but I'm almost certain that doesn't matter. Since this installer is going to our production staff, the installer not killing itself once the program was launched from the post install window is an issue. Anyways, any help would be appreciated.

You need to add nowait flag.
As the documentation shows, the typical set of flags to be used for your purpose is postinstall nowait skipifsilent:
Filename: "{app}\MYPROG.EXE"; Description: "Launch application"; \
Flags: postinstall nowait skipifsilent unchecked

Related

Execute postinstall program (sub installer) with administrator privileges in Inno Setup even if the main installer does not have them

Just like in this question, I'm trying to implement an installer which starts another 3rd party driver installer at the end of the installation.
This is achieved by running my installer with administrative privileges (which is the default if not specified):
[Setup]
PrivilegesRequired=admin
And then using runascurrentuser at the end:
Filename: "{app}\drivers\driver.exe"; Description: "Install optional drivers"; \
Flags: postinstall skipifsilent runascurrentuser
This works if the user has administrator privileges from the beginning.
However, I would like to allow the basic application to be installed even if the user doesn't have admin privileges. Only if the optional drivers are to be installed, should Windows pop-up the "User Account Control" window, and ask for the admin password if the user is not an admin.
Therefore I would like to start the installer without elevated privileges, and only elevate to admin if (and when) the optional diver installation is to be started.
If you want the [Run] entry to "run as Administrator", no matter what are the privileges of the installer, try adding runas Verb (what must be combined with shellexec flag, what in turn imply nowait, so you might want to add waituntilterminated explicitly):
[Run]
Filename: "{app}\drivers\driver.exe"; \
Description: "Install optional drivers"; \
Verb: runas; \
Flags: postinstall skipifsilent runascurrentuser shellexec waituntilterminated
It's also doable from the Pascal Script:
Inno Setup - How to run an aplication with admin privileges if the setup is set to PrivilegesRequired=lowest?

Inno Setup cannot launch .exe in System32

I'm using Inno Setup to make an installer for my program. I would like to run IIS Manager after installation. So, I'm using this code:
[Tasks]
Name: StartAfterInstall; Description: Run IIS after install;
[Run]
Filename: "C:\WINDOWS\system32\inetsrv\InetMgr.exe"; \
Description: "launching IIS prova"; \
Flags: postinstall nowait skipifsilent; Tasks: StartAfterInstall;
This should open IIS manager, but it doesn't work, returning me this error:
Could not execute file C:\WINDOWS\system32\inetsrv\InetMgr.exe
CreateProcessor failed, code 2 , file not found"
Using same code, but running other .exe file in a different path works. Does this depend on this specific path: C:\WINDOWS\system32\inetsrv?
There's probably only 64-bit version of the InetMgr.exe.
As Inno Setup in a 32-bit application, it by default gets redirected to C:\Windows\SysWOW64 (32-bit version of C:\Windows\System32). If there's no 32-bit version of InetMgr.exe in the C:\Windows\SysWOW64, Inno Setup cannot find it.
Add the Flags: 64bit to make Inno Setup find 64-bit version of the the InetMgr.exe.
Or use the 64-bit install mode.
Side note: Do not hard-code C:\Windows\System32, as that path can be different on some systems. Use {sys} constant.
[Run]
Filename: "{sys}\inetsrv\InetMgr.exe"; Flags: 64bit; ...

How to force NOT running the program after silently installing existing Inno Setup package

I need to push a program that was packaged with Inno Setup. I'd like to just install it and be done, not start it yet. However, when using the /silent or /verysilent parameter, the program in question still runs after installation. After some searching around, I'm guessing the person who wrote the original package forgot to set skipifsilent in the [Run] section.
I've tried using /saveinf with the "Run this program when installation is complete" box is unchecked, and then /loadinf - no dice, it's not specified in that file.
What are the magic command line parameters to make this (otherwise very simple) install complete without starting the program afterwards? If there are none, is there a simple way to repackage it so it won't start after installation?
There's no way to skip post-install run entries from command-line, using the .inf file, or any other way.
All you can do is to de-compile the package, modify it (adding the skipifsilent flag) and re-compile.
You can use for example the Inno Setup Unpacker.

Inno Setup skips postinstall when 3rd party software installation was cancelled

I'm using Inno Setup, and I need to install a 3rd party software. But if I cancel the 3rd party installation, the setup will skip the postinstall run tasks and proceed to completing setup wizard which prompt for computer restart. Is there a way to proceed to postinstall even after canceling 3rd party installation? Here are the sample code.
[Tasks]
Name: "install_3rdparty"; Description: "Install 3rd party"; GroupDescription: "Prerequisite software:"
[Files]
Source: "driver\3rdparty.exe"; DestDir: {app}\driver
[Run]
Filename: "{app}\driver\3rdparty.exe"; StatusMsg: "Installing 3rd party"; Check: IsWin64(); Tasks: install_3rdparty; Flags: skipifsilent
Filename: "{app}\my_program.exe"; Flags: postinstall; Description: "Launch my program"
Inno Setup for some reason believes that the 3rd party installer made a change that requires restart.
Probably because the 3rd party installer scheduled a file replace for the next reboot.
You can disable Inno Setup from detecting this using RestartIfNeededByRun directive:
When set to yes, and a program executed in the [Run] section queues files to be replaced on the next reboot (by calling MoveFileEx or by modifying wininit.ini), Setup will detect this and prompt the user to restart the computer at the end of installation.

Prevent installed application from launching during silent installation

I have a setup file called sample.exe that is not built by me.
When it is launched, at the final step of installation wizard, it has a checkbox asking user if they would like to launch the program after installation is done, and by default that checkbox is ticked.
Now, I would like to execute sample.exe silently using /VERYSILENT.
It was able to silently install that program. But the problem is, after silent installation, the installed program is launched, which is not what I want.
My question is, how do I make it so that program is not launched by default when performing silent installation?
If you can re-build the installer, use the skipifsilent flag.
[Run]
Filename: "{app}\MyProg.exe"; Flags: postinstall nowait skipifsilent
See [Run] & [UninstallRun] sections in Inno Setup documentation.
If you cannot rebuild it, there's no way. You cannot control running the application at the end of the installation using command-line, nor installation settings file (/loadinf=) .
This link provides information about the auto launch of apps after installation. Inorder to remove the auto launch feature in your setup, you got to remove [RUN] section ( [RUN] section is optional ] and rebuild the setup

Resources