Copy the exee file to the remote machine

I used PsExec to copy and run an exe file on a remote computer. I also want to copy the xml file to a remote machine. I can do it.

PsExec.exe -d -c \\someserver c:\somefile.xml 

The above command throws an error saying that the system cannot find the specified file, but adds the xml file to the remote server.
You have the best way to copy files to a remote server.
Is there any PsTool for this?
Or an option in PsExec?

Edit: (Reply) I found out that using Powershell, we can copy the file to remote computers, and it worked.

+6
source share
4 answers

As you can read from psexec help

-c: Copy the specified program to the remote system for execution. If you omit this option, the application should be in the system path on the remote system.

So, your xml file has been copied to the remote sys / USER: [username] username] and executed, this gives you an error.
If your xml is part of an application that you must run on a remote computer, one of them compresses the application with all the necessary files in a self-extracting EXE, which launches the main command upon extraction.

If you just need to copy the file, why not use a simple script that displays the remote folder and then copy the file? Sort of:

 NET USE \\computername\sharename password /USER:[domainname\]username xcopy ..... NET USE \\computername\sharename /DELETE 
+6
source

PsExec is not designed to copy files between computers. He can only copy the program that he is about to run remotely.

If you have access to a remote computer, you can copy c:\somefile.xml \\\\remote-machine\Admin$ running copy c:\somefile.xml \\\\remote-machine\Admin$ before starting PsExec.

+3
source

You can use this template with psexec to copy any extension ...

psexec -d -i 2 \ PC Name -u domain \ username -p password cmd / c copy \ server \ location \ file_name c: \ xx \ xx \ xx

PS: Refer to the PSEXEC switches if you don't know what to do -d and me. However, โ€œ2โ€ is the remote desktop user session identifier, which can change each time a new remote desktop session is created.

0
source

this helped me copy my exe file to the c: \ windows directory (one to one in the same domain):

 PsExec.exe -d -c \\remoteserver -u administrator -p password c:\executable.exe 
-1
source

Source: https://habr.com/ru/post/913005/


All Articles