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!

Map Drives and 80070043 error 1

Status
Not open for further replies.

penauroth

Programmer
Oct 30, 2001
325
0
0
US
I am trying to map a read-only network share. I can successfully map using the net use command:

Code:
C:\net use Z: \\myserver\myshare
The command completed successfully.

However, when I use vbscript:
Code:
Set objNetwork = WScript.CreateObject("WScript.Network")

objNetwork.MapNetworkDrive "Z:", "\\myserver\myshare\"

Set objNetwork = Nothing

I get the following error message: "The network name cannot be found."

This is happening on all systems on this particular subnet. Other shares (r+w) on the same server are mapping fine. Thanks.

Paul

Work on Windows, play on Linux.
 
Change your script to:

Code:
Set objNetwork = WScript.CreateObject("WScript.Network")

objNetwork.MapNetworkDrive "Z:", "\\myserver\myshare"

Set objNetwork = Nothing

The MapNetworkDrive does not accept the mapping with a trailing slash.

Spong
 
Genius! Good work Spong. Star for you.

The troubling error did not raise its ugly head but I don't understand why one drive won't map and the other 2 will? The other two also has the trailing slash.

Code:
objNetwork.MapNetworkDrive "X:", "\\myserver\myshare1\"
objNetwork.MapNetworkDrive "Y:", "\\myserver\myshare2\"
objNetwork.MapNetworkDrive "Z:", "\\myserver\myshare3\"

The other subnet does not have any problems with the trailing backslash.

Paul

Work on Windows, play on Linux.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top