PDA

View Full Version : Installers and UAC with Mapped Drives



Caboose
08-02-2017, 04:41 PM
I'm working on an installer currently in use and the bases is this:

When installing to a mapped drive with UAC on Windows treats the Admin profile which the installer runs under and the local user profile as two separate entities. Where you run into issues is selecting a mapped drive letter in the installer, unless an elevated command prompt was run to net use that share under the admin profile they do no show up for the installer. I'm looking for a way to circumvent that.

The easiest method I've found is to add the reg key "EnableLinkedConnections" which basically just makes the admin share see the mapped shares under the local profile. I've tested this and it does work, I'm aware that Windows 8.1 may have some issues with it but also saw that Microsoft released a hot fix that should correct that.

My issue now is implementing that reg key in the installer to run and add to the registry without prompting the user. Since the key requires a reboot in order for the drives to show up between the profiles I'm trying to run it as a pre-req, say if this key doesn't exist add and then require a reboot in order to continue install. So far I've gotten it search and either find the key or attempt to add but it always prompts asking if you're sure you want to add an item to the registry.

I've been playing around with various different ways to add the key and so far the only method I've gotten to add the key without prompting is via cmd prompt, and haven't had much luck figuring out how to fire cmd prompt via the pre-req in install shield.

Any suggestions to either get this reg key added without prompting or if someone has an alternative solution to the UAC admin share mapped drive issue I'm open to new ideas as well.

Cary R
08-03-2017, 01:36 PM
If I recall correctly the Prereq engine uses ShellExecute() to run stuff. So you should just be able to use a *.bat file.

A *.bat file will show the command window, though. So if that's a dealbreaker, a c# executable is just a few lines of code.

Caboose
08-08-2017, 12:01 PM
If I recall correctly the Prereq engine uses ShellExecute() to run stuff. So you should just be able to use a *.bat file.

A *.bat file will show the command window, though. So if that's a dealbreaker, a c# executable is just a few lines of code.

Thank you for the suggestions Cary. My previous attempts with the bat file were still prompting the user for confirmation on adding the registry item which we don't want. I'll poke around with these and see what I can come up with.

chad.petersen
08-08-2017, 02:29 PM
Are you just trying to run a file with a .REG extension? If so, maybe instead write a small installer that sets your reg keys and then put that installer into a Pre-req. This would get you away from using a .REG file directly and if you uninstalled it could remove the reg keys that were added where running a .REG file doesn't give a chance to undo anything that it did, natively.

Just a thought.

Chad