Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MapNetworkDrive: Can't Use Other User's Credentials

Status
Not open for further replies.

BoobooBear

Technical User
Nov 26, 2002
2
GB
I am trying to use the Windows Script Host from a VBA module to map a drive letter to a share drive on a remote server across a Novell network. I want to use another user's credentials (userid and password) as they have been set up with the appropriate permissions. I am using the following code:

Code:
Public Function MapDrive()
 Dim wshNetwork As IwshNetwork
 Set wshNetwork = CreateObject("WScript.Network")
 wshNetwork.MapNetworkDrive "E:", "\\SERVERNAME\VOLNAME", _
                            False, "UserId", "Password"
End Function
I have included a reference to the Windows Host Script Object Model (ver 1.0) in my project.

My problem is that I am getting an automation error message on the "wshNetwork.MapNetworkDrive ..." line when I attempt to map to the remote server. It seems the userid and password arguments are not being recognised, as the above function will allow me to map to a share drive which I have rights to under my current (logged in) userid even if I include the final 2 arguments, giving them nonsense values. The function also works if I log into the remote server with the appropriate userid and password. I've checked the syntax again and again but can't see where I'm going wrong. (I've also confirmed that the values I'm using for the userid and password are correct!) I have a feeling there's a very simple answer. Can anyone help please?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top