Hi I'm trying to form a psexec (or perhaps robocopy?) command which will allow me to use given account credentials to copy a directory over to a remote machine. I'd prefer to use robocopy, but the remote machine is an XP machine.

I've tried something like these commands which don't do what I want them to

psexec \\compB -u blah -p blahblah -i -c -f robocopy.exe path1 networkpath2 /E

So how can I flip this around so that it will use those credentials and run robocopy remotely, transferring files from computer A to computer B?

I can successfully transfer files using a straight up robocopy command using machine names but it needs to work when we're not on the same domain. Psexec from what I understand allows me to impersonate as a user (so use the credentials) and run programs remotely, but since xp doesn't have robocopy built in and I need to reference files on my local machine as well as transfer to the remote machine, I don't know how the whole thing is going to work.

robocopy compAPath \\compBNetPath /E

that's the robocopy command which successfully copies files, but won't this only work when we're on the same domain? and won't it not use credentials? If i change the machine name to \\machineipaddress will it work when not on the same domain?

to give a sense of context, I'm forming these commands then firing them off to a command line to run a bunch of them on the remote machine, so if I can use some magical c# wizardry to make the commands run using credentials so they don't need to be included in the commands themselves, let me know.

1 Answer 1


Hi this is the author. In case you were wondering, I resolved this issue. here's the command that allowed psexec to work with robocopy and use the correct permissions:

psexec -u username -p password -c -f c:\pathtorobocopy\robocopy.exe sourceFile arguments(/E /Z etc.) destinationUNCpath

my not giving psexec a destination machine, it simply runs robocopy locally with the given credentials, sending the information over the network to the destination machine :D

  • Hey that is a cool - didn't realize that doing this locally would pass in the credentials.
    – jtreser
    Jul 30, 2010 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy