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!

Ben
  • 33
  • 1
  • 2
  • 9
  • If you try the command locally on the target machine using the same credentials to log on does it work? – Helvick Nov 13 '10 at 07:13
  • 1
    Have you tried using UNCs (maybe using the admin shares c$,d$) instead of local paths? – Zoredache Nov 13 '10 at 08:35
  • Are you copying files locally on the remote machine? i.e.: copying from one local directory/drive to another? – Simon Catlin Nov 13 '10 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 '10 at 22:11

2 Answers2

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

adamo
  • 6,867
  • 3
  • 29
  • 58
  • 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 '10 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 '10 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.

Ben
  • 33
  • 1
  • 2
  • 9