Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Adding Mapped Drive via logon script


  • Please log in to reply
3 replies to this topic

#1 ArialNuker22

ArialNuker22

  • Members
  • 1 posts
  • OFFLINE
  •  
  • Local time:01:39 PM

Posted 20 May 2018 - 06:49 PM

Good evening,


I have recently been trying to get a bit more familiar with Windows Server 2012 R2 (we had covered Windows Server a little bit back in College, but my hands on experience is rather limited so I am trying to familiarize myself).

 

been wanting to know the best way to map drives for an AD user via a logon script? would someone mind posting steps?




Thank you for your time!



BC AdBot (Login to Remove)

 


#2 JohnnyJammer

JohnnyJammer

  • Members
  • 1,117 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:QLD Australia
  • Local time:02:39 AM

Posted 22 May 2018 - 05:41 PM

Try not to use login scripts for mapped rives mate, always use a GPO to create network drives as it gives and allows for more targeted user base.



#3 Bulgaristan

Bulgaristan

  • Members
  • 276 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Bulgaria
  • Local time:06:39 PM

Posted 01 June 2018 - 10:15 AM

Here are the steps for the script creation but as Johnny said this is really bad practice as you will have a file with the username and password without encryption.

Step 1: Open Notepad

The command NET USE allows you to setup a mapped network drive and follows this syntax:

net use <drive letter><network path>

You substitute the variables with your drive information:

net use F: \\server\files

And voila, there's your basic script.

Save the notepad file as <whatevername>.bat

Step 2: Add switches to your script

You can add switches to your script for different options, such as:

/delete - to delete a mapped drive 
/persistent:yes/no - to reconnect the drive upon login

I personally leave it the way it is and just add one more line:

del <whatevername>.bat

This way, I drop it in a user's startup folder and it will run once and that's it.

I would amend to use GPO as well here is the procedure here
https://community.spiceworks.com/how_to/17039-mapping-drives-with-group-policy-preferences-and-item-level-targeting



#4 MasterNe0

MasterNe0

  • Members
  • 143 posts
  • OFFLINE
  •  
  • Local time:12:39 PM

Posted 14 June 2018 - 10:06 AM

Make sure to save your scripts .bat files in the NETLOGON shared folder on the domain controller.

 

That way, you can go to a user account properties in AD Users and Computers, go to Profile and you should see LOGIN SCRIPT. You can then add the script file name their such as "LOGIN.BAT" and save it so when the user logs in, it autoloadds those mapped drives each and every time they login.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users