Solved

Map a network drive and assign a drive letter with a batch file

Posted on 2006-11-28
5
405 Views
Last Modified: 2010-04-10
Hi

I have a program that needs a mapped drive to exist.  I have a batch file that runs each time the user logs in.  I would like to add a line that add a batch file that creates a mapped drive with a drive letter and path to my files.
I already have one in the user profile of Active directory so I need another one as a batch file.  How do you do that?

Mike
0
Comment
Question by:MickaelE
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
ryandale56 earned 500 total points
ID: 18032555
net use Z: \\server\share

(where Z: is whatever drive letter you want)
0
 
LVL 7

Expert Comment

by:dlangr
ID: 18032560
in the batchfile add:

net use delete g:
net use g: \\server\share

You can use any letter you like, not just g, as log as it is still free.

type: net use /?   from the command line for help
0
 
LVL 7

Expert Comment

by:dlangr
ID: 18032564
log = long
0
 
LVL 6

Expert Comment

by:ryandale56
ID: 18032618
if you are going to add the "net use /delete g:"  it is /delete no just delete....notice the leading slash.
0
 

Expert Comment

by:vk3jed
ID: 18033650
I always find the method below is the most reliable

net use X: \\server\share /yes /persist:no

What this does is maps X: to \\server\share.  /yes means answer "yes" to any prompts, without stopping for user input, and /persist:no means that the share won't be persistent (remapped) at next login.  This can help with unexpected issues (e.g. if the bat file lives on a server or the server hosting the share is down at the time, it won't be mapped.  Therefore, the absence of X: can be an sign there is a problem, and you won't have Windows being bogged down by trying to access a nonexistent network drive.

Before running the batch file for the first time, make sure that the drive letter to be used is not mapped (X: in the example above).
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question