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?
 
Jeremy WeisingerSenior 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
 
theberesfordCommented:
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_layerCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.