Question Locked

Strange problem with net use command /

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Dear all,

i have a vb script that calls the net use command on the IPC,then copies some files from the share drive and then releases the share.
This procedure is executed for a number of hosts (windows 98 & xp pcs).
The Server is a 2003 server (on a domain)
The command in question is:
net use \\10.30.1.54\IPC$ /USER:user pass
The problem is that:
when the net use is executed from the script,then it fails giving an error = 2 about start parameters,on 80% of all execution tries.

When i execute exactly the same command from the command line window it never fails.

What could be it be?

Thank you very much,
Chris

4 replies

by retro77

Why are you copying files to the IPC$? You should copy it to a share like C$ or \sharename

by scott_heath

This doesn't exactly answer your question, but to be more stable you could use the WScript.Network object to map the drive. You are, after all, writing in vbscript anyway. Why use the WScript.Shell at all? :)

Try this:
Set oNetwork = WScript.CreateObject("WScript.Network")
pNetwork.MapNetworkDrive "Z:", "\\10.30.1.54\IPC$", False, sUserName, sUserPassword

Let me know how it goes. Oh, btw, I agree with the other poster. Use c$ instead of IPC$. Good luck, let me know how it goes.

by christos.ververidis

Actually, this is not my code.They used pretty complicated VB scripts to copy some MS Access dbs from network pcs to the server:
I would never do that this way,i 'm just called in to support...i have to resolve this on my own.
For example,this batch file(which i did for testing) executes correctly and it is exactly the same as the one executed from within the script.
[code]
net use \\10.30.1.54\IPC$ /USER:domain\user pass
robocopy.exe "\\10.30.1.54\land" "D:\CopyDBs" PTA1-A.mdb /R:3 /W:30
robocopy.exe "\\10.30.1.54\land" "D:\CopyDBs" PTA3-A.mdb /R:3 /W:30
robocopy.exe "\\10.30.1.54\land" "D:\CopyDBs" PTA5-A.mdb /R:3 /W:30
net use \\10.30.1.54\IPC$ /delete

The pc with IP=10.30.1.54 uses a windows xp OS.
For other pc's the same procedure work (from the script).
It's not a good idea modify their code and add network maps as you suggested.
Could it be a problem the fact that the first net use does not assign a drive letter to the mapped drive?

As you see,the first instruction connects to the InterProcessCommunication,
the second copies from the share "land" and the third is obvious.
i tried connecting with net use \\10.30.1.54\C$
Consider also that the share "land" is on drive C.
Do you have any ideas?
Thank you very much

This discussion is closed to new replies.