Running app from Mapped Drive – Avoiding UAC Prompts
While reinstalling a Windows Vista system the other day I ran into a problem with the UAC security prompt. The primary applicaiton that is run on this computer is not installed locally but run directly from a mapped drive. Normally the user just clicks on the shortcut and the app launches but after a clean install and all updates I was now getting prompted to enter credentials to allow the app to run. Since the user isn’t an admin and I don’t want them to have admin rights, this was an issue. I knew it can be set as I’d done it before but took a little bit to figure out the workaround I’d used. So for when I forget again, here’s the workaround used:
I setup a batch file (see below) that first checks that the drive is mapped, if not, it will map the drive. Then it will launch the program. This part I had done but was still getting the error. The trick I forgot was that the batch file needs to be placed into a “secure location” in order to run without the elevation request. The three locations that I know of that are considered secure are
- \Program Files (including subfolders)
- \Windows\system32
- \Program Files (x86)\ (including subfolders for 64-bit versions of windows)
Once the file was setup here, I no longer get the security prompts. So the users are happy they don’t get the UAC prompts and I’m happy that I don’t need to give out the admin rights to run apps.
Here’s a copy of the basic batch file used:
If NOT exist R:\somefile.exe ( net use R: /delete net use R: \\1.2.3.4\SharedFolder /user:USERNAME PASSWORD /persistent:no ) Start /D R: somefile.exe exit
A reference link on Microsoft Technet: http://technet.microsoft.com/en-us/library/dd835564(WS.10).aspx#BKMK_ElevateUIAccessApps