Showing results for 
Show  only  | Search instead for 
Did you mean: 
Not applicable

Custom Action to run As Admin


I have a Basic MSI project which includes a custom action that runs an Installscript code.
The script has to copy some external files somewhere early in the installation process (later installed services need them).
I set it to run After InstallFiles in Install Exec sequence.
I have to set the In-script Execution for CA as Immediate Execution, if not I cannot retrieve the SOURCEDIR path - where my external files are.

if I build a setup, everything goes well.
If I build only an MSI, the xCopy function in the script fails with 'Access is denied' when the target path is a restricted folder (like 'Program files...'.).
So, I presume that the script does not run with Admin privileges.

How can I force the script to run As Admin?
Do I have other solution?

Labels (1)
0 Kudos
(2) Replies
Level 8

Have you set "Require Administrative Privileges" to yes in the "Summary Information Stream" of your MSI ?


0 Kudos
Level 10

Only Deferred actions can run with Elevated (Administrative) Privileges. To retrieve the value of properties in deferred custom actions, you'll need to use the CustomActionData property to pass information to a deferred action.
0 Kudos