Mapped Drive Issue

I have a Linux box that has a shared drive I need my Windows users to access. The drive has a username & password to access it. Can someone provide some vbscipt code that will map the drive? The path is \\156.56.23.65\folder and also can I hard code the username & password in the code so the users want have to type it in? This is a Win 2008 server domain with active directory.
LVL 15
wantabe2Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Jeremy WeisingerConnect With a Mentor Senior Network Consultant / EngineerCommented:
You can also use Group Policy Preferences to map the drive. That way you can give access to your users without revealing the password to them since it will be stored in Group Policy.
0
 
theberesfordConnect With a Mentor Commented:
a batch using net use command will do that job perfectly :

NET USE X: \\156.56.23.65\folder /USER:domainname\username password
0
 
X_layerConnect With a Mentor Commented:
Dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")

Dim strLocalDrive, strRemoteShare, strUser, strPassword

strLocalDrive = "H:"
strRemoteShare = "\\myserver\users"
strUser = "username"
strPassword = "password"
objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, True, strUser, strPassword

Open in new window

Note that True is for storing the mapping persistently in the users profile.
0
All Courses

From novice to tech pro — start learning today.