PowerShell, as an extension method!

I just put together a quick little example of how to host PowerShell inside your own application, but to make it more useful I built it as an extension method so that you can basically call ToPowerShell(…) on any object. If the object happens to implement IEnumerable then there is an alternative ToPowerShell(…) which allows you to specify whether to enumerate the items.

Download the sample if you are interested.

About these ads

3 thoughts on “PowerShell, as an extension method!

  1. Pingback: PowerShell, as an extension method! - Rod Trent at myITforum.com

  2. Pingback: Development in a Blink » Blog Archive » PowerShell as an Extension Method

  3. Andrew Tobin

    Thanks for sharing, Mitch!

    I always forget how Powershell can be used inside applications… I’ll have to do some more investigating, as there’s a few major applications at work I’d like to go the other way with – provide a way to script/automate into them via Powershell, so I can script common jobs or provide ways to iterate data, etc, without needing to add things to our application.

    Thanks for the pointers, and hope you’re having a great holiday period.

    Andrew

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s