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.

I have a user johndoe with the following drive mapping in his login script (.bat file).

net use y: \\myserver\users$\johndoe

However, when I try to use a more generic mapping using the username variable the Y drive maps to \filesvr\users i.e. it seems to ignore or not be able to look up the user name.

net use y: \\myserver\users$\%username% /persistent:yes

I checked that the user has sufficient permissions on his home directory and that the drive is not already mapped.

The user is logging on to a desktop from home using VPN and RDP.

Any idea why this is and how to get around it?

share|improve this question
    
If you manually try to set it up, do you get any errors? –  Nixphoe Jul 29 '11 at 20:15
    
haven't tried - we're both remote right now and logging to his machine not possible right now. –  zen Jul 29 '11 at 20:21
    
Make a script that says "echo %username% > \some\location\username.txt" and execute that script at login exactly like you're running this .bat file. Then open the txt file and see what's printed out then see if that matches the pathway you're intending it to map. –  Safado Jul 29 '11 at 20:36
    
thanks - will try that - though I think it may return an empty file :) –  zen Jul 29 '11 at 20:43
    
@Ryan - could I not just put that echo line in my user's login script - right before I set the mapping? –  zen Jul 29 '11 at 20:45
show 1 more comment

1 Answer

Try checking what %username% maps to on the local machine. If you're logging into the desktop on your local workstation as "bill" then %username% will be "bill". If Bill's login is "bjohnson" then %username% will still be "bill" and not "bjohnson".

share|improve this answer
1  
Do what? There isn't a "mapping" to a "local username". The username is the username. Local accounts have nothing to do with it assuming the user is logging-on with a domain user account onto the client computer. –  Evan Anderson Jul 31 '11 at 2:14
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.