0

I am trying to use xcopy on a remote machine with psexec but i keep getting an error 4 and would love some brainstorming as to why that error might come up. The actual error says: Invalid drive specification 0 File(s) xcopy exited on 'remote machine' with error code 4

The command I am using is: psexec \'remote machine' -u 'user' -p 'pass' xcopy 'source path of file' 'destination path'

Both file paths are located on the remote machine. I am typing the command on my local machine. Any advice or questions are very welcome. Thanks!

4
  • If you try the command locally on the target machine using the same credentials to log on does it work?
    – Helvick
    Nov 13, 2010 at 7:13
  • 1
    Have you tried using UNCs (maybe using the admin shares c$,d$) instead of local paths?
    – Zoredache
    Nov 13, 2010 at 8:35
  • Are you copying files locally on the remote machine? i.e.: copying from one local directory/drive to another? Nov 13, 2010 at 17:24
  • Just to clarify some of your questions, it does work locally when the destination path is on my machine. The source path is a shared network drive and the destination path is a path located on the remote machine.
    – Ben
    Nov 15, 2010 at 22:11

2 Answers 2

1

It seems that error 4 means: "Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line."

EDIT: Microsoft's page on XCOPY

2
  • There is definitely enough space for the file and copy activity. I think that error is coming up because I am leaving something out maybe.
    – Ben
    Nov 15, 2010 at 22:12
  • Replace xcopy with a batch file that echoes its arguments. Is what is printed what you expect it to be?
    – adamo
    Nov 17, 2010 at 12:48
0

So I fixed this after changing a few things. I made sure the parameters in the exact order as the psexec documentation and I added the domain in front of the username. I'm not sure exactly what fixed it, but it works now. Thanks for all the pointers, they taught me a lot.

2
  • You have to close the question, because it resurfaces on the top page, although you fixed the problem.
    – adamo
    Nov 26, 2010 at 21:37
  • sorry, how do I do that?
    – Ben
    Dec 1, 2010 at 19:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .