1

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?

zen
  • 211
  • 4
  • 11
  • 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
  • Sure, just remove it when you're done. – Safado Jul 29 '11 at 20:58
  • Does the user have permission to read the hidden share users$? The user may not be able to map subfolders if it cannot read that parent directory – xXhRQ8sD2L7Z Nov 24 '14 at 05:24

1 Answers1

-1

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".

  • 4
    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 02:14