PowerShell Team

Automating the world one-liner at a time…

Latest posts

May 30, 2008
Post comments count 0
Post likes count 0

New Free Windows PowerShell Quick Reference Card

PowerShell Team

I've been working with the folks over at Developer Zone on a quick reference card for PowerShell, based on my book. The card is now complete and is available as a free download. (PDF, registration required.) This is an 8-page card that covers the PowerShell language, common commands and  examples. The card was written primarily for developers (it is Developer Zone after all) and for people with existing scripting experience. Even so, if you're using PowerShell, it should be a handy reference to the environment. Thanks -bruce =============================== Bruce Payette [MSFT] Principal Developer, Windows P...

May 28, 2008
Post comments count 0
Post likes count 0

WPF & PowerShell – Part 7 (Sharing Hosts)

PowerShell Team

Well here we are at the end of a week of WPF.  We've learned how to create basic, simple user interactive interfaces.  We've seen a brief glimmer of the golden UI layer that is WPF, and have seen how we can use PowerShell to add easy interactivity to XAML.  You've seen tricks to help you work your way through .NET code, and help you unwrap the mysteries of WPF. We've seen how we can use PowerShell's list processing technology allows for simple binding to WPF's controls, and how WPF applets can help you present a simple front ends to PowerShell functionality.  We've gotten a very brief taste of...

May 27, 2008
Post comments count 0
Post likes count 0

WPF & PowerShell – Part 6 (Running Functions in the Background)

PowerShell Team

For the next part in the series, I've introduced another update to the Show-Control function you first met in Part 4.  In this update, I've added the ability to run the control you've created in a background runspace as a switch. In order to do this, Show-Control employs a neat little trick.  It actually creates a background runspace, uses Get-Command to find out its own definition, and packs itself into the runspace it just created.  Then it removes the switch parameter that told it to run in the background, but adds every other argument.  It also makes sure to recreate the event handlers tha...

May 26, 2008
Post comments count 0
Post likes count 0

WPF & PowerShell – Part 5 ( Using WPF & PowerShell Modules)

PowerShell Team

In the last post we met XAML, and I gave you a core function (Show-Control) that will help you make interactive WPF controls quite nicely in PowerShell. You can see that, by using Show-Control, it is possible to reduce the size and complexity of a script that creates UI.  Today, I'll show you how to build small applications by building functions and modules you can use later. But before we get into that, I'll explain some more of the benefits I see of using scripts to produce user interfaces: Let's focus on the 3rd benefit as we build up a few controls that rely on each other.  First, let's ma...

May 25, 2008
Post comments count 0
Post likes count 0

PowerShell and WPF: WTF

PowerShell Team

A number of people are confused by the WPF/PowerShell series and are "asking WTF?".  Aaron has a blog entry, WPF and PowerShell Series - I don't get it.  Caywen left a comment on the first in posting saying, "Ugh, I could make a peanut butter and squid sandwich, but that doesn't mean you should." (I like the visual on that one!). I thought I would take a couple of minutes to explain a couple of points and provide some context. PowerShell is NOT a CLI I bet that one took you by surprise.  Yup - it's true PowerShell is not a CLI.  PowerShell is an AUTOMATION technology.  Cmdl...

May 24, 2008
Post comments count 0
Post likes count 0

WPF & PowerShell — Part 4 (XAML & Show-Control)

PowerShell Team

We're not halfway through our week of WPF, and I'm pretty sure at this point that you have an all right grounding in the basics of WPF & PowerShell, but so far, the scripts haven't really been very much like most PowerShell scripts, and the UIs have not been like most WPF UIs.  The scripts have been a little odd because they haven't really made use of a common convention of PowerShell... the pipeline.   The WPF examples have also been a little verbose because they do not include any XAML. XAML is an XML format you can use to write user interfaces that use WPF.  Because WPF is very property...

May 23, 2008
Post comments count 0
Post likes count 0

WPF & PowerShell — Part 3 (Handling Events)

PowerShell Team

So far, most of the wpf and powershell scripts you have seen have seen just show you something, but don’t do anything that interactive. However, In order to make real applications you need to be able to handle events. Luckily, PowerShell can make that pretty easy. It is possible to cast a script block to an event handler. The script block has two variables: $this (which is the sender), and $_, which contains the event arguments. Here’s a simple example of using this to click a button: $window = New-Object Windows.Window $eventHandler = [Windows.Input.MouseButtonEventHandler]{$this.Close()} $w...

May 23, 2008
Post comments count 0
Post likes count 0

WPF & PowerShell – Part 2 (Exploring WPF (and the rest of .NET) with Scripts)

PowerShell Team

In my previous post, I showed you how to create “Hello World” scripts using Windows Presentation Foundation (WPF) and Windows PowerShell. While “Hello World” is relatively easy to write with WPF, it is only the tip of the iceberg of the types of quick user interfaces you can write. Windows Presentation Foundation provides an amazing array of controls for an incredible array of purposes.  Out of the box, with just one control, you can: ·         Show a listbox ·         Play a video or audio file ·     &nb...

May 22, 2008
Post comments count 0
Post likes count 1

WPF & PowerShell – Part 1 ( Hello World & Welcome to the Week of WPF )

PowerShell Team

Welcome to the Week of WPF.  During the next 7 days, I’ll help show you how you can use WPF and PowerShell together. PowerShell could always script almost everything in .NET, but, prior to the recent CTP2 you could not script Windows Presentation Foundation (WPF) in PowerShell. Now you can script everything that WPF can do within PowerShell. This means you can write pretty sleek looking UIs in nice little PowerShell scripts. There are a lot of things you can do with this capability, but let’s start things off simple.   Windows Presentation Foundation (WPF) is a set of .NET libraries for making next-gene...