Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 2

Elevate privileges during installations (UAC issue)

Project Type: InstallScript MSI
InstallShield version: 2011

I am been struggling to get this right. We have a project, with a "Workstation" feature (files are copied locally to the C drive), and a "Server" feature (files could be copied to a network shared drive - we have a script that reads a "drive file" from the C drive to determine where the files will be copied for this feature, and it could be a network shared drive).

Our current setup works fine in pre "UAC" OS, but if UAC is turned on it cannot copy files to the network drive.

The catch here is that, for the workstation we need "Administrator" privileges so that we can copy files to the C drive, so we have the "Required Execution Level" set to "Highest available" or "Administrator" as either of them work. However, this setting prevents the installer from copying files over a network drive.

If we set the "Required Execution Level" to "Invoker", the installer is able to copy files to the mapped network drive, but of course, it fails to copy files locally.

So, I was thinking that I could create a script to change the "Required Execution Level" for each feature, and set it to run on the OnInstalling feature event of each feature.

My questions are:

1. Will this approach work?

2. If 1=Yes, how do I change the "Required Execution Level" through code? Please provide example.

3. If 1=No, then how can I accomplish this?

Thanks much!
Labels (1)
0 Kudos
(2) Replies
Level 9

Check out this link, I think it addresses your issue.

Basically, mapped network drives do not by default make it into the elevated state of an application. There is a registry tweak that will allow this but it is not something you will be able to do on the fly in your installation, nor is it something I would force on your users. Have you thought about having the user specify a UNC to the network share?
0 Kudos
Level 2

Thanks Eric!

We actually saw that, but we also saw somewhere else, probably on a KB article that Microsoft does not support that workaround.

We also would not want to force that on our users. We were hoping to get a resolution through the installer. Will the approach I suggest not work? It seems to me (logically thinking) that It would. Except, that I am not sure how to code the elevation of privilege.
0 Kudos