net use: how to map drive for both normal and elevated processes in Win 10?

3

In my Windows 10 Enterprise machine I've noticed if I execute "net use" command in elevated mode, then processes run in normal mode will not see the mapped drives. Also if I execute the command as normal user, then elevated processes will not see the drives.

The mapped drives are not persist, which is intentional.

So currently I have to execute the command twice, and have type the credentials for the remote shares twice, which is very inconvenient.

Is there any solution to eliminate the double action?

g.pickardou

Posted 2017-03-23T14:01:21.757

Reputation: 224

1I usually create a .cmd file in which I first make the network mapping, then launch the program. You can then create a shortcut to that program. Running the batch file as admin also creates the network mapping as admin. Running it as normal user, visa versa. Alternatively, open a commandprompt as admin, execute the net commands and just keep the window open. Now run your program as admin and it will find the network share. Once done, close the command prompt. (useful for those installers. – LPChip – 2017-03-23T14:31:31.643

@LPChip I have to type my credentials to the remote system, which can not be stored in the batch file. So this way I have to type twice...or missed I somthing? – g.pickardou – 2017-03-23T18:13:09.700

@DavidMarshall: I've just tried (then restart), does not work plus adds the side effect that I had to consent [Yes] in an extra step whenever I run a program configured to run in admin mode. – g.pickardou – 2017-03-23T18:21:07.597

Well, what you want doesn't seem possible. Running a program as administrator is a complete separate process, It runs a program as a completely different user with a different environment and different rights. So if you need to run a program many times, just open a command prompt as admin and one without, in both make the network mapping (yes twice login) but keep the command prompts open. Now you can start other programs with or without admin access for as long as you want, until you close these command prompts. – LPChip – 2017-03-23T21:55:18.893

No answers