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!

objNetwork.RemoveNetworkDrive 1

Status
Not open for further replies.

GenTrac

Technical User
May 14, 2004
98
0
0
Anyone help me please, I am running this script that will check if 4 drives are mapped and if drive letter used, disconnect them and remap to what was set in this *.vbs file. When I run this script I only get Object required: " error message... Where am I going wrong?...Many Thanks

Dim objNetwork
Dim strDrv(3)
strDrv(0) = "g:"
strDrv(1) = "i:"
strDrv(2) = "j:"
strDrv(3) = "k:"
dim strPath(3)
strPath(0) = "\\servera\c$"
strPath(1) = "\\serverb\c$"
strPath(2) = "\\serverc\c$"
strPath(3) = "\\serverd\c$"
Dim d
For d=0 to 3
objNetwork.RemoveNetworkDrive strDrv (d)
objNetwork.MapNetworkDrive strDrv(d), strPath(d)
next
 
You forgot to instantiate objNetwork:
Set objNetwork = CreateObject("WScript.Network")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top