Saturday, September 20, 2008

Change MSI to run under custom actions under user account

MSI package generated by VS2008 will run custom actions under SYSTEM account. This "feature" was implemented to work around Vista's UAC.

There is no way to change this behavior from VS2008, but you can adjust MSI package using ORCA tool (available in SDK).

Start ORCA tool, open MSI package, navigate to custom actions. Select action which you would like to run under user account and subtract 0x800 from Type. In my case, value generated by VS2008 is 3090, new value should be 1042.

Save MSI back. Done

5 comments:

Evgeny M. Lutsky said...

Hi,
Very important post for me.
Thanks.

But what can I do, if I have number like 51 in the Type column?

In more details, I have msi, that run dll with installer class during Install custom action.

When I opening MSI with Orca, I see install action, devided to 2 rows - one for InstallUtil - with number 3073 (1025 after 0x800 substructed) and another custom action with number 51.

I I do not changed nothing, I see 4 processes msiexec in TaskManager - 2 with my account, and 2 with System account.

After me change 3073 to be 1025, I see 3 processes - 2 with my account, and 1 with system.

I think, that my dll (Type = 51) is still running under system account.

How can I change this behaviour? I also tried to substruct 800 from 51, but it does not work.

Thanks

AlexEzh said...

I have 4 actions with type 3090 in my setup. I only needed one action to run as a user, so I changed one row to 1042. As a result I have 3 actions running as system and one as a user.

I have a row with 52 type named VSDCA_FolderForm_AllUsers. I have not changed anything for this row.

Evgeny M. Lutsky said...

Thanks Alex,
I already fixed this - rows with 51/2 are not relevant, I just changed both Install and UnInstall rows and now it works!
Very usefull post, I looked for this several days :( :) !!!

Unknown said...

Dude that is an awesome find, this was a real show stopper for us!

Magnus Wennergren said...

Thanks for the info!
It works great for me. Only one problem.. Now I have to manually edit the msi after every rebuild of MSI file. Is there really no way to automate this step, e.g with a command line tool?