Member_2_1334455
asked on
objNetwork.MapNetworkDrive VBScript question
I have the following script set for when users log onto the domain:
(SEE CODE SNIPPET)
Id like to know, if the computer doesn't have the appropriate user name and password saved to connect to the specified servers, how can I implement that into the script (entering the user name and password) so the drives are automatically mounted?
Thanks in advance,
(SEE CODE SNIPPET)
Id like to know, if the computer doesn't have the appropriate user name and password saved to connect to the specified servers, how can I implement that into the script (entering the user name and password) so the drives are automatically mounted?
Thanks in advance,
On Error Resume Next
Dim WSHNetwork, path
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "X:" , "\\192.168.0.103\server"
objNetwork.MapNetworkDrive "Y:" , "\\192.168.0.103\Documentation"
objNetwork.MapNetworkDrive "S:" , "\\192.168.0.100\signature"
objNetwork.MapNetworkDrive "O:" , "\\192.168.0.100\edocs"
objNetwork.MapNetworkDrive "B:" , "\\192.168.0.100\bboard"
objNetwork.MapNetworkDrive "I:" , "\\192.168.0.100\BVImages"
wscript.sleep 300
'Clean Up Memory Used
set WSHNetwork = Nothing
'Quit the Script
wscript.quit
ASKER
The code doesn't seem to work...
On Error Resume Next
Dim WSHNetwork, path
Dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
strLocalDrive = "X:"
strRemoteShare = "\\192.168.0.103\server"
strPer = "FALSE"
strUsr = "USER"
strPas = "PASS"
objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, strPer, strUsr, strPas
strLocalDrive = "Y:"
strRemoteShare = "\\192.168.0.103\Documentation"
strPer = "FALSE"
strUsr = "USER"
strPas = "PASS"
objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, strPer, strUsr, strPas
strLocalDrive = "S:"
strRemoteShare = "\\192.168.0.100\signature"
strPer = "FALSE"
strUsr = "USER"
strPas = "PASS"
objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, strPer, strUsr, strPas
strLocalDrive = "O:"
strRemoteShare = "\\192.168.0.100\edocs"
strPer = "FALSE"
strUsr = "USER"
strPas = "PASS"
objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, strPer, strUsr, strPas
strLocalDrive = "B:"
strRemoteShare = "\\192.168.0.100\bboard"
strPer = "FALSE"
strUsr = "USER"
strPas = "PASS"
objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, strPer, strUsr, strPas
strLocalDrive = "I:"
strRemoteShare = "\\192.168.0.100\BVImages"
strPer = "FALSE"
strUsr = "USER"
strPas = "PASS"
objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, strPer, strUsr, strPas
wscript.sleep 300
'Clean Up Memory Used
set WSHNetwork = Nothing
'Quit the Script
wscript.quit
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
exx1976:
I tried your solution, but I get a syntax error. I'm confused as to what to put in the domain section.
My domain is "hq.mrjanitorialsupplies.c om" so I tried that and I still got the syntax error.
Could you please notify me what I am doing wrong?
Thanks,
Chris
I tried your solution, but I get a syntax error. I'm confused as to what to put in the domain section.
My domain is "hq.mrjanitorialsupplies.c
Could you please notify me what I am doing wrong?
Thanks,
Chris
Set oNetwork = CreateObject("Wscript.Network")
oNetwork.MapNetworkDrive "I:",\\192.168.0.103\BVImages",,"hq.mrjanitorialsupplies.com\USER","PASS"
The domain should only be the NETBIOS name of the domain, not the FQDN. Just use HQ and it should work fine.
ASKER
Alright this is what I did and it seems to be working fine now.
Thank You.
Thank You.
On Error Resume Next
Dim WSHNetwork, path
Set oNetwork = CreateObject("Wscript.Network")
oNetwork.MapNetworkDrive "B:","\\192.168.0.100\bboard",,"hq\USER","PASS"
oNetwork.MapNetworkDrive "I:","\\192.168.0.100\BVImages",,"hq\USER","PASS"
oNetwork.MapNetworkDrive "Y:","\\192.168.0.103\Documentation",,"hq\USER","PASS"
oNetwork.MapNetworkDrive "X:","\\192.168.0.103\server",,"hq\USER","PASS"
wscript.sleep 300
'Clean Up Memory Used
set WSHNetwork = Nothing
'Quit the Script
wscript.quit
ASKER
Good answer. Kind of needed the full script to be written out, for us n00bs :) But awesome. Thank you.
Dim objNetwork
Set objNetwork = WScript.CreateObject("WScr
strLocalDrive = "L:"
strRemoteShare = "\\server\share_name"
strPer = "FALSE"
strUsr = "username"
strPas = "password"
objNetwork.MapNetworkDrive