Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys,

I was just creating a small tool to execute shell commands on remote machine and get output and errors.

I am running my application under all privileges.

Example : I should be able to run dir /a on remote machine and get output and so on for other commands.

I just browsed for it and found that psexec is a tool provided to do this task. But I want to do this using .net framework.

If I will used WMI then I can't know when then process is finished and read output.

Anyone have done that before.

Thanks
Posted

1 solution

 
Share this answer
 
Comments
sunder.tinwar 30-Jul-12 4:30am    
thanks for reply. now read this : http://stackoverflow.com/questions/1405209/how-to-execute-a-command-in-a-remote-machine-and-get-the-output-using-c-net

here with WMI approach we can't identify when the process is finished execution.
Zoltán Zörgő 30-Jul-12 4:43am    
Might happen. But you have other wmi tools to follow it's execution: http://stackoverflow.com/questions/8915244/create-remote-process-via-wmi-and-wait-for-it-to-exit
sunder.tinwar 30-Jul-12 4:47am    
thats gone make my code very critical. I need to handle event for each command if i end up using multithreading.
I am looking for simple C# solution if possible. If not then I will think over WMI.
Zoltán Zörgő 30-Jul-12 5:05am    
As I know PSExec is starting a service remotely, and passing the command/application to it. I have not found any Win32API call that might be used to create a process remotely.
sunder.tinwar 30-Jul-12 5:40am    
yes i wanted to create something like psexec only. is there any other work around also?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900