Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Another question about PSExec

Posted on 2006-06-13
4
Medium Priority
?
561 Views
Last Modified: 2011-10-03
Hi another question,

I am trying to use PSEcec to copy files from a Remote Server to a Remote PC (client pc).  I'm running PSExec from my local machine here in St. John's, NL and the remote Server and remote Desktop pc is located hundreds of miles away in Calgary, Alberta.  All i want to do is initiate a copy command from here to the remote site.  Here's the syntax that i'm using:

psexec.exe -d \\gwcg-iqware "c:\windows\system32\cmd.exe copy c:\test.txt c:\test2.txt"

I've tried it with the above command using double quotes around the command to be executed on the remote server and i've also tried it without the double quotes.  The output or return values displayed in my dos window says that the command successfully started with process ID 4268 for example....but the copy didn't happen.  When i log onto the server and check the C:\ drive, there's still only 1 test.txt file - but there should now be 2 files: a test.txt and a test2.txt.

Also, to test that psexec is working or able to connect to that server, i tried the following command to simply start command prompt on the remote server and it worked fine.  I can see the process start in Task Manager....here's the syntax that i used for that (which did work)

psexec.exe -d \\gwcg-iqware "cmd.exe"

I thought you could pass parameters to the cmd.exe call to tell it to copy for example when it runs.  Like you see several lines up.  And finally i've tried creating a .bat file on the remote server that contains the copy command.  I use the following command for that:

psexec.exe -d \\gwcg-iqware "c:\test.bat"

Again i get a return code saying that the batch file executed successfully, but when i check the server there's no new file created like there should be and there's no new process starting in taskmgr either like i see when i tried the cmd.exe call above.  

Any help would be greatly appreciated.

Thanks





Am I using the proper syntax?
0
Comment
Question by:FPIT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 1

Accepted Solution

by:
char1iecha1k earned 2000 total points
ID: 16938605
All you are doing in the line

psexec.exe -d \\gwcg-iqware "c:\windows\system32\cmd.exe copy c:\test.txt c:\test2.txt"

is getting your remote pc gwcg-iqware to copy c:\test.txt c:\test2.txt. Psexec only executes the line you feed it on a remote computer so effectivly you are running this command on the remote pc.

copy c:\test.txt c:\test2.txt

which only copies one file to another file on the same disk.

You need to copy those files from your remote client to your remote server, this means that the remote client will have to have access to a share on the remote server or access to the admin$ account. Also for thinkgs like this try using Robocopy, it comes with the windows resouce kit.

Assuming you have a share on the server accessable by the client the commabnd would be something like this

psexec.exe -d \\client_hostname "c:\windows\system32\cmd.exe copy c:\test.txt \\server_hostname\shared_folder\test2.txt"

Assuming the client has a access to the Admin$ account on the server the commabnd would be something like this

psexec.exe -d \\client_hostname "c:\windows\system32\cmd.exe copy c:\test.txt \\server_hostname\c$\test2.txt"
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Skype is a P2P (Peer to Peer) instant messaging and VOIP (Voice over IP) service – as well as a whole lot more.
All of the resources available today make learning a new digital media easier than ever-- if you know where to begin. This is a clear, simple guide to a few of the basic digital art mediums and how to begin learning them on your own.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question