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 just stopped working?

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
Hello,

I have a script which runs a VPN connection , maps a drive and copies a file accross.

It's been running fine for over two years.

However, all of a sudden the script has stopped working when trying to map the network drive....
Code:
' Update Msg
MsgIE "Mapping network drive, please wait..."

' Map network drive
objNetwork.MapNetworkDrive "x:", "\\servername\foldershare", False, "UserID", "Password"

If Err.Number <> 0 Then 
      Error_Msg
      WScript.Quit
End If

at this point no x: drive is mapped and the error routine is called due to Err.Number <> 0

However, if we drop down to a command prompt and run the 'net use' command the network drive maps without a problem.

Any ideas why this has started to happen and how we can fix it?

Thanks,

1DMF

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
i've put a sleep in right up to 9 seconds , but it is the mapnetworkdrive command erroring not trying to access is.

that error is like it not seeing the remote server via the VPN connection?

but i'm definately using the right UNC path , and it's worked fine on 3 other computers we have tested it on.

I also rewrote it to use shell.run and NET USE , wroked fine on my machine and antoher test machine, but thes machine we want it to work on still it didn't work.

yet as I say if you go to the command prompt and manually run NET USE it maps the drive just fine.

Also using the shell.run command means the eror traping doesn't work, so can't even get an error message to show regarding the net use command.

something has to have changed, but what? and everyone we ask says nothing had been done to the machine, so i'm a bit stumped.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
I'm afraid I am running out of ideas, but last things I would recommend you look at are:

NIC binding order
DNS Settings
NetBIOS over TCP/IP
WINS Settings

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
WINS - Check!
NetBIOS - Check!
DNS - Check!

What would be the binding order?

Plus remembers issuing the NET USE command manually works , issuing the NET USE command via VBScript Shell Object doesn't.

I have this niggling feeling they have changed their AV (Sophos) or something else which is prohibiting VBS from running corrctely or perhaps the Windows Scripting Host has got corrupt.

Like you i'm running out of ideas, this is rather a head thumper!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
For the binding order, go into Network Connections. Advanced, then Advanced Settings. Under Connections make sure the NIC they are using for the Internet connection is on top. Under binding order make sure TCP/IP is on top. On the Provider tab make sure that under Network Providers that Microsoft Windows Network is on top.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top