Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
    
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 7:13
1  
Have you tried using UNCs (maybe using the admin shares c$,d$) instead of local paths? –  Zoredache Nov 13 '10 at 8: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
add comment

2 Answers

up vote 1 down vote accepted

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

share|improve this answer
    
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
add comment

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.

share|improve this answer
    
You have to close the question, because it resurfaces on the top page, although you fixed the problem. –  adamo Nov 26 '10 at 21:37
    
sorry, how do I do that? –  Ben Dec 1 '10 at 19:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.