maandag 13 juni 2011

Determine if a MSI-installation is running

Did you know only 1 MSI (Windows Installer-file) can be running at a time?
So if you are already installing a MSI-file and you try aonother install you'll probably get the following message:
Error 1618 or Error 1500 "Installation already in progress"
But how can you determine a MSI is running before you run your installation?
It's easy! Just monitor the following registry-key for its's presents:
SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\InProgress
If this key doesn NOT exist, you are save to start a Windows Installer-installation.

One way to use this if an user logs in for the first time ever. Often al sorts of MSI-repairs are triggered. So installing software while these MSI-"repairs" are running is not a good idea if you are installing some software at login.

I made a routine to check for 5 seconds (loop) if a MSI was running. If that was the case within those 5 deconds, I would make my installationwrapper wait for 10 seconds and then check again. To protect my wrapper against an infinite loop, the max. wait time was 20 loops (20x 10 = 200 seconds). That should do it when an user is logging in for the very first time!




Sources: http://www.appdeploy.com/messageboards/tm.asp?m=9119&mpage=1&key=&#9119
http://www.installsite.org/pages/en/msifaq/error/1618.htm

Geen opmerkingen:

Een reactie posten