Custom action hangs on running exe or msi

Pragya's picture

Hi,

I have a custom action "Run wisescript from Installed files" scheduled after InstallFinalize in Execute Immediate. This custom action calls an exe, which basically does a couple of things:

1. Gets registry keys and sets a few variables with the paths from the registry.
2. Runs a bat file, that takes an argument as the path retrieved from the registry.

Now, the issue is that the install runs fine when I run it from command line using msiexec /i "path to msi" /l*v c:\log.txt

But when I try running the install by double clicking the exe or msi, the install hangs at the Custom Action. I have put in a  couple of display messages just to make sure it gets into various conditions. These message boxes dont et displayed at all when running the exe or msi directly but then work fine from cmd line.

I am not sure whats the problem here, any help would be appreciated.

Thanks.

Evan Border's picture

Set the logging policy and try debugging

I see no reason why starting the install from the GUI vs. command line should differ, but set the Logging policy so that you get a log file in both situations, then compare the logs.

I trust that you've tested this on various different systems to rule out crazy stuff like whack registry entries messing up the .msi file association, etc.

Anyways, Logging can be set by adding the following registry value:

Registry Key Name: HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Installer\
Registry Value Name: Logging
Registry Value Type: String
If you want to log everything, set the Logging registry value to "voicewarmup"

You could also try the Windows Installer Editor's Debugger to see if that sheds additional light on things.

EdT's picture

Current working directory and path issue

This looks like an issue with window's current working directory.
When you double click an MSI, the current working directory does not change to the MSI folder, the MSI just runs from wherever it was launched from. Equally, you cannot assume that the MSI execution will be aware of anything set in the system path.
Therefore, you should check that your MSI makes NO assumptions about where the MSI or any custom action is running from, so that full paths are always provided to any executables.
Also, if calling batch files, you must run them by calling CMD.EXE from the system32 folder and pass the full path of the batch file as the command line argument, after /c.

Finally, make sure the install is running with Admin permissions, and that you have set the custom action to run in system context if you are changing HKLM registry keys, and in user context if you need to access keys in HKCU

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.