PowerShell Gadget

Posted by Andrew on April 04, 2007

UPDATE: The gadget now has a dedicated page

Introducing my first gadget. I started this partly just to see if it could be done and partly because I thought it might be something that I would use. The good news is that (four complete rewrites and too many late nights later) I was right on both counts.

PowerShell Gadget

The gadget runs in two modes

  • Normal (non-flyout mode) commands may be entered directly into the gadget in the Sidebar. E.g. enter Notepad and hit enter and notepad opens up.
  • Flyout mode, the whole console window is displayed as per the screenshot above. To toggle flyout mode click on the small blue PowerShell icon on the gadget.

The gadget console window is just a hosted instance of PowerShell.exe so you can change the font, colors etc. in the normal way. To get to the console properties window just click the button on the gadget settings dialog.

PowerShell Gadget

Enjoy. (Any and all feedback appreciated).

UPDATE: This gadget requires PowerShell installed to the default location. :-)
UPDATE: Having more than one instance of the gadget open is broken. I am investigating.

Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

  1. [...] .NET Components from Vista Sidebar Gadgets Sometimes, when developing a non-trivial gadget, you need the full power of good old .NET. Fear not, with just a little bit of tasty COM [...]

  2. kfarmerNo Gravatar Thu, 05 Apr 2007 07:03:16 CDT

    Again, very nifty. But I’m thinking — generalize it into a console application hoster. Then in the options, you can specify the app to be hosted (powershell, ironpython, cmd, etc), and whether the flyout shows up automatically when the control has focus. Maybe pick up the exe’s icon and use that in the UI.

    Personally, I think you’ve already done all the hard work. :)

  3. [...] when developing a non-trivial gadget, you need the full power of good old .NET. Fear not, with just a little bit of tasty COM [...]

  4. karl prosserNo Gravatar Tue, 10 Apr 2007 14:13:28 CDT

    Hey great work, good to see a fellow kiwi getting into powershell stuff.. So you you just parenting a true console app (powershell.exe) , or are you hosting the powershell engine. I’m leaning towards thinking you are doing the first?

    -Karl

  5. Nikhil BhandariNo Gravatar Wed, 11 Apr 2007 02:43:31 CDT

    Any idea on to get this install on Windows XP SP2 system. Do I need to install any Gadget Engine which will understand .gadget extension and install it?

  6. AndrewNo Gravatar Wed, 11 Apr 2007 17:18:41 CDT

    Karl,

    Thanks, you would be correct :-) I explored a few options, mainly around hooking up to standard input/output of PowerShell.exe. I got it working but then discovered that things like | and > didn’t work :-( Hosting the PowerShell engine is probably the “proper” way to do this :-)

    Andrew.

  7. AndrewNo Gravatar Wed, 11 Apr 2007 18:23:00 CDT

    Hi Nikhil,

    Sidebar gadgets are a new feature of Windows Vista.

    Andrew.

Comments