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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mapping a Drive on Client 1

Status
Not open for further replies.

c2compliant

Programmer
May 11, 2000
11
0
0
US
I am trying to map a drive for the client on Windows NT 4. Some users may already be mapped, if they are not then I will need to map them. Any suggestions?
 
Try using the windows scripting host
Here is an example

This will get the drives mapped on the client.
Set WshNetwork = CreateObject("WScript.Network")
Set clDrives = WshNetwork.EnumNetworkDrives ' for class of currently mapped drives


For i = 0 to clDrives.Count -1
string1= string1 & clDrives.Item(i)
Next



This will check if the drive you want to map is already mapped if not it will map it.
if instr(string1,"fa11na04") = 0 then

Set WshNetworkU = CreateObject("WScript.Network")
WshNetworkU.MapNetworkDrive "U", "\\fa11na04\Drive"
end if
 
how would you change the user name and password for the mapping. I need to map the drive to a using a specific user name and password.
 
From MSDN :
Code:
object.MapNetworkDrive(strLocalName, strRemoteName, [bUpdateProfile], [strUser], [strPassword])

Arguments
object
WshNetwork object.
strLocalName
String value indicating the name by which the mapped drive will be known locally.
strRemoteName
String value indicating the share's UNC name (\\xxx\yyy).
bUpdateProfile
Optional. Boolean value indicating whether the mapping information is stored in the current user's profile. If bUpdateProfile is supplied and has a value of true, the mapping is stored in the user profile (the default is false).
strUser
Optional. String value indicating the user name. You must supply this argument if you are mapping a network drive using the credentials of someone other than the current user.
strPassword
Optional. String value indicating the user password. You must supply this argument if you are mapping a network drive using the credentials of someone other than the current user.
Water is not bad as soon as it stays out human body ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top