Command Prompt in Administrator mode doesn't see mapped drives

50

18

I am not sure but when I start my Command Prompt in Administrator mode, I can't switch to a mapped drive. I can do so if I am not in Administrator mode.

Am I missing something simple?

AngryHacker

Posted 2013-12-18T19:43:37.073

Reputation: 14 731

Question was closed 2017-07-10T03:49:37.123

What are the permissions on the network mapped drives? – Ramhound – 2013-12-18T19:56:16.177

3That's normal. Map them again in that command prompt. net use driveLetter: \YourUNChere – Mark Allen – 2013-12-18T20:00:23.753

Answers

53

When you start a command prompt "As Administrator" it's running in a different user context than when you don't.

Since mapped drives are user-centric, that Admin user context will not have the (same) drives, and you'll have to map them for that user context once the command window is open as Adminsitrator, e.g. by running net use <letter>: \\<server>\<share>. An example:

net use Z: \\SuperServer\SuperShare

Also, you can enable the EnableLinkedConnections flag in the registry to cause the session token to be shared:

To work around this problem, configure the EnableLinkedConnections registry value. This value enables Windows Vista and Windows 7 to share network connections between the filtered access token and the full administrator access token for a member of the Administrators group.

To do this, set the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLinkedConnections DWORD flag to 1, and then reboot your machine.

For more info on that from Microsoft, see: Some Programs Cannot Access Network Locations When UAC Is Enabled

Ƭᴇcʜιᴇ007

Posted 2013-12-18T19:43:37.073

Reputation: 103 763

2@JasonDuffett same scenario here. Got it to work with: net use Z: \psf\Home – Giorgio Bozio – 2015-03-17T10:15:21.533

The EnableLinkedConnections registry flag does not work for me, on Windows 10. net use in an administrator console works. – Tor Klingberg – 2016-08-31T13:58:39.330

Not working for me either on Windows 7 x64 - net use ... works fine – Angelos Pikoulas – 2017-04-20T20:34:07.330

3This workaround has never worked for me and I'm not sure why. Tried on Windows 7, 8 and 8.1. Trying to access Parallels mapped network drives (\psf*) from within a Windows VM. – Jason Duffett – 2014-01-13T15:37:40.830

15

This makes me think about an old Windows Vista reported issue.

Can you try:

  1. Open RegEdit
  2. Go to HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
  3. Create a DWORD value named EnableLinkedConnections and set it to 1
  4. Reboot the computer
  5. Test again

user2196728

Posted 2013-12-18T19:43:37.073

Reputation: 1 146

Cannot find HKLM in Windows 10 registry, where is it? Ahh I see HKEY_LOCAL_MACHINE. – Owl – 2018-08-28T14:47:13.533

1Yes that didn't work for me in Wondows 10. – Owl – 2018-08-28T14:52:43.240

worked for me, thanks! – user2673238 – 2019-06-12T11:29:22.747

5

One other work-around that took me ages to find is to run net use from a scheduled task as the NT AUTHORITY\SYSTEM account. Apparently drives mapped under this account show up for all users and all elevation levels.

I've tested this and it works even on NFS shares (which can be a bit finicky). Just create a scheduled task set to run at system startup, and specify the following command:

net use //server/share Z: /persistent:no

It might possibly work to run it just once with /persistent:yes, but I haven't tried that. Granted, "just map it again" works too, but that drive still won't be visible to scheduled tasks running in different contexts. The downside is that all real users see it too, so not so good for multiuser setups.

RomanSt

Posted 2013-12-18T19:43:37.073

Reputation: 7 830