Giter Site home page Giter Site logo

vv-b0y / poshconsole Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jaykul/poshconsole

0.0 0.0 0.0 5.22 MB

PoshConsole is a WPF control that self-hosts PowerShell, a framework for building PowerShell-based management apps!

License: Other

C# 99.80% PowerShell 0.20%

poshconsole's Introduction

PoshConsole

PoshConsole is a WPF control that self-hosts PowerShell. It is the core of my framework for building PowerShell-based management applications (which is what I'm currently doing, as a consultant).

You can install it from NuGet:

Install-Package PoshCode.PoshConsole 

You can use in in WPF applications as simply as placing the control in your window:

<pc:PoshConsole xmlns:pc="http://schemas.poshcode.org/wpf/poshcode"
                x:Name="PoshConsole" />

By default, it adds a "Modules" subdirectory of your application root to your PSModulePath, so you can ship your own modules there, and if you leave the window visible, your users can interact with it as though it were a full-blown PowerShell console.

Of course, what makes it interesting is that you can invoke PowerShell cmdlets from code behind as easily as this:

PoshConsole.Invoke("Get-ChildItem");

And the command/script that you invoke is displayed in the console along with it's output -- so in a graphical management interface, it provides you with a way to leverage your PowerShell investment and teach your users the command-line interface at the same time.

You can easily call a command with async await, and then populate a listbox in your UI with the results (as well as displaying the command and the output in the console pane):

    var users = await PoshConsole.InvokeAsync(new Command("Get-ADUser"));
    Dispatcher.InvokeAsync(() => UserList.DataContext = users.Select(u => u.BaseObject))

There is, of course, much more you can do, and I'm just getting started, so there are plenty more features on the way, and I'm still debating a few of the design choices, if you'd like to voice an opinion.

Quick Demo Video

A Caution:

As of this writing, I'm calling this version 0.8.5 -- until I release a 1.0, you should assume that the command API and event handlers may have breaking changes in any release. Having said that, I have been firming this up for several few months (and I have a commercial product about to be released which uses this control), so I expect the API is just about complete.

Thanks

I'd like to thank a couple of vendors who support Open Source by letting developers use their tools for free:

Analyzed by nDepend Refactored by Resharper

poshconsole's People

Contributors

jaykul avatar cristianbaba avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.