Click here to Skip to main content
13,149,731 members (53,438 online)
Rate this:
Please Sign up or sign in to vote.
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.

Posted 29-Jul-12 21:51pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

sunder.tinwar 30-Jul-12 4:30am
thanks for reply. now read this :

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:
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?
Zoltán Zörgő 30-Jul-12 5:47am
Might worth looking around here:
sunder.tinwar 31-Jul-12 4:52am
anyone knows simple .net approach to solve this.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170924.2 | Last Updated 30 Jul 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100