PowerShell Gadget
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.
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.
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.





[...] .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 [...]
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. :)
[...] 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 [...]
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
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?
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.
Hi Nikhil,
Sidebar gadgets are a new feature of Windows Vista.
Andrew.