Question

Environment: Install Shield 2009 Premier, Vista (Home/Premium, Ultimate)

I have a custom action in Install Shield 2009 that would fire during installation. If setup.exe is run its fine, but when run the MyApplication.msi in Vista(please note in other OS the custom actions work just fine) it shows exception running the custom action. Custom action is just executing an exe with command line arguments.

That exe executes just fine individually in that OS. But when MyApplication.msi wants to run it, it shows an exception.

I think: MyApplication.msi can't give that custom action(.exe file) proper privilege(administrative) to run with. But setup.exe can.

How can it be solved...?


From the Custom Action wizard for my custom action, for "In-Script Execution" value I chose "Deferred Execution In System Context"

Was it helpful?

Solution

You didn't state, but it sounds like your setup.exe has a manifest that requires administrative privileges (if you get a UAC prompt when you launch setup.exe, this is the case). It also sounds likely that the exe you are trying to run from your custom action has a similar administrative privileges requirement. An exe custom action in MSI uses CreateProcess which cannot elevate.

If your action runs in the UI sequence, you need to use ShellExecute or ShellExecuteEx somehow - this can be done with an InstallScript custom action using LaunchApplication with the flag LAAW_OPTION_USE_SHELLEXECUTE, or with C++ that calls ShellExecuteEx directly.

If your action runs in the Execute sequence, you should mark it "Deferred in System Context" so it is launched from an elevated context to begin with. This is generally preferred (at least in terms of user experience) as it avoids the extra UAC prompt that the other method will show. However any deferred action has limitations (such as minimal property access) you may need to familiarize yourself with.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top