2

When I run an installation from Inno Setup with:

Installer.exe /VERYSILENT

The command immediately returns even though the install takes about 10 minutes. So, if I run:

Installer.exe /VERYSILENT
DoNextThing.exe

DoNextThing.exe runs while the installer.exe is still installing.

I would like to run some configuration after the install is successful. Right now, in powershell, I do the following:

$h = Start-job -name Installer -ScriptBlock {."Installer.exe" /VERYSILENT}
$h   # the ps job control commands show this job as complete very quickly
sleep 10
$x = Get-Process -ProcessName Installer
while ($x -and ! $x.HasExited)
{
   write-output "waiting ..."
   sleep 10
}
# Do some configuration

Although this seems to work, I think I must be missing a better way to do this. I do not want to make it part of the installer as this configuration is just for the Jenkins test environment.

Any ideas why the powershell job management does not work for this? Am I using powershell incorrectly, or is the Installer.exe generated by Inno Setup not working well with powershell? [should I be using cmd.exe instead of powershell?]

rkh
  • 1,761
  • 1
  • 20
  • 30

2 Answers2

1

You might have to just add a command to the RUN section in inno-setup to create a file "IamFinishedInstalling.txt" as the last thing it does.

Your powershell can then block on that file rather than try to figure out process or job statuses.

while (! (Test-Path "IamFinishedInstalling.txt")) { sleep 10 }

If the installer.exe is really returning before the install is finished, this may be the simplest thing you can try.

  • 1
    Although this does work, the linked question provides a cleaner answer of piping to Out-Null – rkh Oct 16 '15 at 16:19
0

Why use a job at all? Just run the installer using the installer command. When the executable completes, PowerShell will continue on to the next line of the script.

Bill_Stewart
  • 22,916
  • 4
  • 51
  • 62
  • 2
    In the first line in the question, that is what I tried. The installer returns immediately even though it has 10 more minutes to go to finish. I edited the question to clarify this. – rkh Oct 16 '15 at 04:13
  • To those reading the comments: The question did not say that originally (hence this answer). – Bill_Stewart Oct 16 '15 at 12:51