Search code examples
windows-7wixwindows-installerwix3

How can I launch an application as administrator after a WiX MSI has completed?


How can I launch an application with administrator rights after I have completed an installation using a WiX-based MSI?

I can launch the application just fine on Windows XP, but with Windows 7, it's an issue.

The application has a manifest embedded in it that says it should run as administrator and I've changed the impersonate attribute in the Custom Action to "no". I can't change the execute attribute to deferred, as this only works before the InstallFinalize action, and I need it after the user has clicked Finish in the MSI.

This is my custom action:

<CustomAction Id="LaunchApp" FileKey="App" ExeCommand="[Command Line Args]" Execute="immediate" Impersonate="no" Return="asyncNoWait" />

Solution

  • I couldn't use WixShellExec as I needed to pass in command line arguments if certain conditions were true. So I just created a custom action that launched the exe through cmd prompt. Hacky, but a viable workaround and it works without a hitch.