Search code examples
filebatch-filecopyblockingpsexec

Getting back a file sent from remote PC using BATCH with PsExec C#


I am coding a program in C# to communicate with a remote PC in an Wifi AdHoc network. I execute a BATCH file in the remote that will send to the local a CHECK.txt file. I use PsExec.

Everything works fine in my C# program when I execute this batch file remotely with PsExec from the local PC to copy the CHECK.txt file in any of the remote's directories. The problem comes when I modify this BATCH to copy the text file to the LOCAL:

copy C:\Windows\CHECK.txt \\192.168.1.10\C$\Windows

It seems that the process PsExec, used to execute the BATCH in remote, blocks the communication of the network when the BATCH tries to send back to the local the text file. Ports 445 and 139 problem? Any idea of what is blocking the file to be sent back?

Everything is set for a transparent dialog between remote and local (no firewall, etc).

Thanks in advance...


Solution

  • I just noticed the -s parameter on your PSEXEC command. The -s means Run the remote process in the System account.. Removing it should allow your batch script to write back to local computer.