Jump to content

Pstools - Remotely Run .exe Or .bat Files - ?


Recommended Posts

Im trying to remotely execute a .exe over my windows 2003 network. Basically i just need to know what tool i should be using for this. I was trying to use pstools but i dont think i have the syntax correct. this is what im typing...

psexec \\examplepc -c c:\examplefile.exe

My understanding of the command tells me that this should run a file located on my machine on a remote machine.

i keep getting error code 0 or error code 1

Does anyone know what the heck im doing wrong lol... or if there is a simpler way to perform this task?

Link to comment
Share on other sites

I think the command only runs file son the remote machine, not from your local machine. You would need to copy them over to the other machine, and also, have access rights to even start a process on the other machine. If you were on a domain and you were admin, this wouldnt be an issue, but I suspect you need an account and password as well to launch the process on the other machine, as well as any services required to enable this to happen, such as ICS, Workstation, Server, Computer browser, etc. Also, the other machines firewall may be blocking your access, so you will need to know what ports its going over and open them at the remote machine. If this is across the internet and not a lan, you would also need to port forward anything that needs to get through.

Link to comment
Share on other sites

  • 2 weeks later...
Im trying to remotely execute a .exe over my windows 2003 network. Basically i just need to know what tool i should be using for this. I was trying to use pstools but i dont think i have the syntax correct. this is what im typing...

psexec \\examplepc -c c:\examplefile.exe

My understanding of the command tells me that this should run a file located on my machine on a remote machine.

i keep getting error code 0 or error code 1

Does anyone know what the heck im doing wrong lol... or if there is a simpler way to perform this task?

The command syntax is as follows:

psexec.exe \\computer name or ip address -u administrator username for the remote machine -p administrator password for the remote machine -c "remote file path to execute"

I've tried that on my VMs and that worked fine.

Edited by Infiltrator
Link to comment
Share on other sites

  • 3 weeks later...

psexec does infact run your executable on the remote machine. if you get an error code of 0 then all is well and the executable ran fine, a code of 1 means it didn't. you can run cmd.exe as the executable and then when you get a prompt run a seperate exe. if you are in a domain and already have rights to the server, then you will not need to supply a username and password. Just an FYI, but you might have a bunch of processes running on the remote server already because in looking at your post you said that you got a response of 1. so if you ran calc.exe 20 times, you might still have 20 calc.exe's running on the server. another thing to remember is that there is no userspace for remotely ran programs on the remote server. meaning if you did run calc.exe as yourself remotley and then remoted into the server using mstsc you will not see the calculator, but you would see the clac.exe process running.

Edited by Tarbizkit
Link to comment
Share on other sites

psexec does infact run your executable on the remote machine. if you get an error code of 0 then all is well and the executable ran fine, a code of 1 means it didn't. you can run cmd.exe as the executable and then when you get a prompt run a seperate exe. if you are in a domain and already have rights to the server, then you will not need to supply a username and password. Just an FYI, but you might have a bunch of processes running on the remote server already because in looking at your post you said that you got a response of 1. so if you ran calc.exe 20 times, you might still have 20 calc.exe's running on the server. another thing to remember is that there is no userspace for remotely ran programs on the remote server. meaning if you did run calc.exe as yourself remotley and then remoted into the server using mstsc you will not see the calculator, but you would see the clac.exe process running.

That was the interesting part I found while trying to execute IE.exe on the remote computer. I was expecting it to open the actual Internet Explorer application, but it didn't so after trying to run IE.exe for several times and no sign of internet explorer windows opening up, I deceived to open up Task manager on the remote computer to see if there was any happening and guess what, I had more than 5 instances of the IE.exe running on the background.

But yeah that was fun.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...