Mapping drives with a script in AD

Discussion in 'Hardware' started by amberH, Apr 12, 2011.

  1. amberH

    amberH Private E-2

    Hello,

    I need to map drives for different users on PCs that I don't have physical access to.
    I've done a bit of research, and think maybe what I need to do is create individual scripts for each user, mapping their drives, and add the script to their profile in Active Directory.

    I must be missing a step, or perhaps not understanding where this file should sit.
    I have a public share on one of our data servers that I have created a folder - and stored the userName.bat file there.

    my userName.bat file looks like:

    @echo off
    net use o: \\serverName\FolderName


    Under the profile tab for this user in Active Directory I've tried a few things, but currently have:
    Profile Path: blank
    Startup file: \\serverName\Subfolders\username.bat

    Nothing happens when I log in - the drive doesn't map.
    If I copy the line i have in the startup file, and paste it in My Computer and double click the file, it maps the drive fine, so I know I have the correct location and filename.

    Any suggestions?

    Thanks!
    Amber
     
  2. techsent

    techsent Corporal

    Hey AmberH,

    The userName.bat file should be in the NetLogon share. Here's more details on the actual path of that share http://www.petri.co.il/setting-up-logon-script-through-active-directory-users-computers-windows-server-2008.htm

    also, leave the profile path textbox field blank and instead, type in only the name of the bat file (leave the path out) into the login script textbox field.

    and many admins use the delete command to clear all previous (the * handles this) mappings before mapping again. like this...

    @echo off
    net use /delete *
    net use o: \\serverName\FolderName

    The method above requires that you complete the same steps for each user acount in AD that will need the logon script. If you have many users that need the script invoked, you can look into setting up the one bat file to work with group policy.

    Techsent
     
    Last edited: Apr 12, 2011
  3. amberH

    amberH Private E-2

    That worked!
    Thanks so much!

    I did add the line to delete all previous mappings - and that didn't work.

    I had:

    net use /delete *
    (Space between delete and *)

    Cheers,
    Amber
     
  4. amberH

    amberH Private E-2

    I just realized that when I have the:

    net use delete /* line in there - I am prompted, via CMD window when I log in, asking me to confirm that I want to delete all mapped drives.

    Is there a way to have the mapped drives delete without prompting?

    Amber
     
  5. techsent

    techsent Corporal

    sorry amber, here it is

    net use /delete * /y

    Techsent
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds