I mentioned in a previous post that I was launching command line utilities from an ASP.NET web app and capturing the output. I wrote a little multithreaded .Process wrapper class to encapsulate this behavior. It's nothing magical, but it is handy for these scenarios:

This is a companion discussion topic for the original blog entry at:


I am in process of creating a script in that will backup our sharepoint sites/databases etc… I found your code on the internet and it seems to be very helpful…however i try to dim s as New Shell and Visual Studio underlines the object Shell as if the namespace is not imported or something. Do you think that is the problem? If so, what is the namespaces that i have to import? There are two commands that i will be running in the dos command console and i want to capture the output of the commands to write into a log file. So, it seems like some of the code that you have here would be quite useful and helpful for me to do this. Any help would be greatly appreciated.



Hello-- you need to add the second file (starting with “Public Class Shell”) as a class file to your solution.

Brilliant. Just what I was looking for.

Yeah, what Ed said. Exactly what I needed. You rock yet again Mr Atwood.

You appear above the fold when googling for “ capture shell output” (sans quotes) too, nifty :slight_smile:

Very nice work. I needed a quick way to execute shell commands and capture the output, and this fitted the bill nicely.


You are the man. Exactly what I was looking for.

That is some high-speed stuff right there. Thank you Sir.

can u tell me how to open a network file using impersonation

Can u tell me how to Open the Network files using Imeprsonation in