Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When I map a shared folder to a drive in Explorer in Windows Server 2008 R2 the new drive letter (say Z:) does not work in cmd.exe (started as administrator).

What am I doing wrong?

I believe this only happens on systems where UAC is active.

share|improve this question
1  
Obviously the drive is mapped into the security context in 2008 R2, so it's not like XP. If you want to mount a drive, for a user working on a Windows 2008 R2 Terminal, you need to map the drives using his account, otherwise the drive map will be isolated from him. –  Andrew Smith Jul 17 '12 at 8:01
    
That statement doesn't make sense to me. What does it have to do with XP? How does a terminal come in? And who is "he" in "his account"? –  Andrew J. Brehm Jul 17 '12 at 16:34
add comment

1 Answer 1

up vote 6 down vote accepted

You should map the drive from within your administrative CMD session instead, as it is using a different user context (the one of the administrative user obviously) and thus has no access to the environment of your "regular" user. From http://msdn.microsoft.com/en-us/library/windows/desktop/ms685143(v=vs.85).aspx :

Drive letters are not global to the system. Each logon session receives its own set of drive letters from A to Z. Therefore, redirected drives cannot be shared between processes running under different user accounts. Moreover, a service (or any process running within its own logon session) cannot access the drive letters that were established within a different logon session.

Just issue

net use z: \\server\unc\path

to establish the mapping in your cmd session before executing whatever you want to be done with it.

share|improve this answer
    
I thought UAC was the same user context but running with full permissions rather than restricted. –  Andrew J. Brehm Jul 17 '12 at 16:33
    
@AndrewJ.Brehm You are using the same user for elevation (i.e. the user you are running with is the same user context but with privileges stripped)? In this case, you have the same user name, but a different account token and a different logon ID, which basically results in the same problem - see support.microsoft.com/kb/937624/en-us. You could set EnableLinkedConnections as described in the article to let LSA re-create your mappings in the elevated session, but mind that it this feature is marked as "unsupported". –  the-wabbit Jul 18 '12 at 10:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.