0
votes

I have written an msi which deals with registry. So, i have to run the msi as admin.

when i directly click and launch the Msi,I get the following error to modify the ini file "Access to the path is denied"

It works fine if i launch the msi from command prompt(Right click as administrator.)

I tried all the below suggestions but none of them is working. please assist how to run msi as admin.

Package Id="*" InstallerVersion="200" Compressed="yes" Platform="$(var.Platform)" InstallPrivileges="elevated" AdminImage="yes" InstallScope="perMachine"

CustomAction Id="UpgradeSelectedVersion" BinaryKey="CustomAction" DllEntry="UpgradeSelectedVersion" Execute="deferred" Impersonate="no"

Property Id="ALLUSERS" Value ="1"

or

Property Id="ALLUSERS" Value ="2"

2

2 Answers

0
votes

Try the following:

<Property Id="MSIUSEREALADMINDETECTION" Value="1" />

Otherwise, you could wrap your installer in a wix managed bootstrapper application, a bit more work though. Then you add settings to your manifest file.

0
votes

That custom action is deferred, which means it must be running in the InstallExecuteSequence, which should be elevated and running with the system account if you have InstallScope per machine and elevated privileges.

  1. Don't mess with the ALLUSERS property because WiX just does the right thing. InstallScope per machine and elevated privileges will make it work. If you accidentally turn it into a per user install by messing with ALLUSERS then it will not be elevated and it will fail.

  2. You should be seeing a UAC elevation dialog after the UI sequence. If you are not seeing this dialog then the install will not be elevated. Again, that might be related to you changing ALLUSERS. If you are installing this in silent mode then it will also fail because silent really does mean silent, and it will not show the elevation dialog and your CA will not run elevated.

  3. It's possible that your failing custom action is not the one you posted, which is deferred and therefore after the elevation prompt. If you have a custom action in the UI sequence then it will not be elevated (unless you run the MSI from an elevated prompt) so that may explain the issue you are seeing.