Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy a non exe File to a Remote Machine

I used PsExec to copy and run an exe file in a remote machine. I also want to copy a xml file to remote machine. I am able to do this way

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

The above command throws error saying system cannot find the file specified but adds the xml file to remote server.
Do u know any better way of copying files to remote server.
Is there any PsTool available for that?
Or an option in PsExec ?

Edit: (Answer) I found out that using Powershell we can copy file to remote machines and it worked.

like image 666
sriram Avatar asked Apr 12 '12 06:04

sriram


People also ask

How do I add files to a remote desktop?

The File Browser opens on the RHS of the remote window. Click 'Upload File', select the file, and click 'Open'. The file will be saved on the desktop of the remote computer. Alternatively, you can navigate to a desired location via the file browser and upload the file to a specific folder.

How do I transfer files using PsExec?

Copying local programs to the remote computerUsing the -c switch, psexec will copy any local program to the remote computer prior to execution. When you use the -c switch and don't specify an executable file, PsExec will still copy the file but you'll receive an error stating system cannot find the file specified.

Does PsExec need to be installed on remote machine?

Prerequisites for PsExec File and printer sharing must be enabled on both local and remote computers (TCP port 445 must be open on remote computers). It could be a potential security risk, so make sure you enable this port for the Private profile in the Windows firewall.


1 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 must be in the system path on the remote system.

So your xml file is copied on remote sys/USER:[domainname]username]tem and executed, this gives you the error.
If your xml is part of an application you have to run in remote computer, one solution is compress the app with all necessary files in a self-extracting EXE that runs main command when extracted.

If you just have to copy a file, why don't you use a simple script that maps remote folder and then copies file? Something like:

NET USE \\computername\sharename password /USER:[domainname\]username
xcopy .....
NET USE \\computername\sharename /DELETE
like image 142
Marco Avatar answered Sep 19 '22 04:09

Marco