Saturday, July 26, 2008

Execute a PowerShell Script from your VB or C# code

Is This Thing On? - Calling a PowerShell Script From Your .NET Code

"Well, Mike F. reminded me to write this article on 5/29 and I am FINALLY getting around to doing it.  I borrow very heavily from the article written by Jean-Paul Mikkers found at: 

http://www.codeproject.com/KB/cs/HowToRunPowerShell.aspx

NOTE:  There is an async version of his code that he does as a follow up.  I don't use it because I want to remove extra code noise to focus on the act of calling the script itself.  If you want to take a stab at the async version (and there are LOTS of good reasons to do so) then you can go here:

http://www.codeproject.com/KB/threads/AsyncPowerShell.aspx

So, on to the goodness!

..."

This is a cool article on how you can call, execute, etc PowerShell from your C# or VB projects. It takes a step by step approach and walks you through it from start to finish.

No comments:

Post a Comment

NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...

ALL comments are moderated. I will review every comment before it will appear on the blog.

Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...

I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...

Please see my comment policy for more information if you are interested.

Thanks,
Greg

PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...