Windows – How to access network shares from an elevated process in Windows 7

elevationnetwork-shareswindows 7

With UAC set to the Default level, it is not possible in Windows 7 to access mapped network folders from an administrative command prompt or any other elevated process.

This leads to unwanted errors, e.g. when trying to import a *.reg file that is located on a network share. Double-clicking results in the following and rather confusing error message after accepting the UAC prompt:

Cannot import M:\sharename\settings.reg: Error opening the file. There may be a disk or file system error.

Is is possible to have the already mapped network shares also available when running with elevation? Or is there a workaround to that behavior?

Update: I know that is works to open an administrative command prompt and mount the drives using net use. This makes the share available to all elevated processes; however, doing so is not persistent and needs to be repeated after each log on.

Best Answer

In short, no. There's no supported way to copy the current set of mapped/authenticated network resources from a non-elevated context to your elevated context. For all intents and purposes, they're separate logins that you just happen to be able to interact with from the same console. Being able to communicate between elevated and non-elevated processes would kind of break the whole security purpose of keeping them separated.

However, if these network drives are mounted using the credentials of your user account (and not a separate login/password), you could try just accessing them with the UNC path instead of an actual drive mapping.