2
votes

I have a Visual Studio setup with a custom action written in C++. I need to launch a process from a custom action but both Install and Commit actions are run elevated and thus my process runs elevated too. I want the new process to run as a regular user.

I have seen Start exe after msi install but using current user privileges but it seems overly complicated and shows no code. I haven't got the time to experiment with an unknown API.

Are there any easy ways? Can I use VS Setup to define a non-elevated custom action or do something from the elevated custom action?

2

2 Answers

1
votes

Visual Studio setup projects do not support immediate custom actions. They are all deferred by default.

So either you use custom code to impersonate the current user or you switch to another setup authoring tool which supports immediate actions.

2
votes

If you just want to test your code, it wouldn't be hard to update your built msi file with Orca. It'll let you add the dll with your code to the binary table, add a corresponding row to the customaction table, and add the action to a sequence.

If you need this to happen as part of your build process, you could accomplish the same thing with vbscript. The SDK comes with good sample vbscript code for interacting with an msi database, as described here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa372865%28v=vs.85%29.aspx