Click here to Skip to main content
11,802,636 members (70,164 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# .NET Process WMI
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 at 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ő at 30-Jul-12 4:43am
Might happen. But you have other wmi tools to follow it's execution:
sunder.tinwar at 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ő at 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 at 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ő at 30-Jul-12 5:47am
Might worth looking around here:
sunder.tinwar at 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
0 KrunalRohit 366
1 OriginalGriff 365
2 F-ES Sitecore 295
3 Afzaal Ahmad Zeeshan 230
4 CPallini 230
0 OriginalGriff 2,950
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,695
4 Richard MacCutchan 1,157

Advertise | Privacy | Mobile
Web01 | 2.8.151002.1 | Last Updated 30 Jul 2012
Copyright © CodeProject, 1999-2015
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