WPF and Powershell Series — I don’t get it.

I don’t get it.

Maybe it will become clear as the series progresses, but the idea of a powershell cmdlets, etc. powering a WPF front end doesn’t make sense to me.

I thought the whole idea idea of Powershell was that it was a shell plaform — an advanced command prompt?

Instinctively, I think — no GUI. Mixing WPF and Powershell together feels somehow wrong, like using a mud topping on a bowl of ice cream.

Nonetheless, here’s the start of the series. The first post suggests it will be a “7 day” series.

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

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

WPF & PowerShell — Part 3 (Handling Events)

Do you use the Powershell? I’ve tried it — and never gotten far as it’s just not solving a problems I encounter regularly.

10 Comments

  1. I find it hard to believe that Powershell doesn’t help solve any problems that you have. You must not have any problems then? :)

    I am really interested in WPF and Powershell because there are many times when creating useful scripts that decisions need to be made. Those decision points can be presented in a useful way in a GUI better than in a limiting console. It’s nicer to select a file than to have to type it in or pick from a long list of items in a list box than a long list of items on a console.

    Bruce

  2. Bruce – what do you use powershell for? What type of user are you (IT, developer, artists, chef, … :) )?

    Seriously — I can’t think of a single reason I would need powershell on even a monthly basis — but maybe I’m missing something.

    Having never tried — is it possible to use the cmdlets within a GUI (write a gui app which uses Powershell code, rather than the other way around)?

  3. Aaron,

    What can PowerShell do for you? It may not be for everyone. That is understandable, and you may not have any use for it at all, depending on your day-to-day stuff.

    As for can a GUI run a PowerShell command… For sure. Basically that’s how the Exchange 2007 admin interface runs: The GUI is actually calling cmdlets in the backend to complete all the user’s requests. Exchange is just one example…

  4. Aaron, I’m a 28 year developer/IT/Admin/DBA kind of person. I have always worked in a small group and have had to do all kinds of things. I always look for ways to automate stuff and I have used batch files, 4nt, VB Script, C++, VB, PowerBasic, Python, and Perl to do the tasks that I need to do. It’s important that I get the most productivity that I can out of the tools that I use. I’ve been looking at PowerShell to see if I can use it to replace most of the other tools that I use for automating tasks. While it doesn’t behave exactly the way that I would like it to from the command line and it doesn’t perform as well as something like PowerBasic or Perl, it does have the capabilities to replace the tools I use and to make my life easier.

    I currently use PowerShell to do things like:

    1. Process data contained in multiple spreadsheets and convert the data to something that PADS (a system that shares information about personnel that work at Nuclear Power Plants) will accept.
    2. Display status information on several IIS servers that I am responsible for.
    3. Automate a multi step process of a vendor install into a single step.
    4. Automate a clean startup of Oracle Application Server on a Windows server.
    5. Import podcasts into iTunes from the folder structure that Juice downloads into.

  5. Bruceatk –

    Powershell is definitely is more “IT” focused — that’s why I’ve never needed it … I’ve dabbled, but never found it valuable in my day to day development/architecting needs.

    It sounds like you put it to all sorts of good uses. Why do you use it over Perl/PowerBasic?

  6. I consider Perl “write only” for the most part. I find it hard to go back and maintain anything but simple Perl scripts. I suppose that the way some people are writing their PowerShell scripts you could probably say the same thing about it.

    PowerShell provides some powerful commands that free you from doing the plumbing code required in normal languages. For example:

    $ImportedFile = import-csv c:\some_file.csv

    Will read in the entire file and place it into an object collection where each field described in the first line of the csv file is now a property of the object.

    If you have csv file like:

    first_name, last_name, id_number
    Bruce, Atkinson, 01234

    the example line of PowerShell above would let you reference them like this:

    $ImportedFile[0].first_name
    $ImportedFile[0].last_name
    $ImportedFile[0].id_number

    In a regular language you would have to loop through the file parsing out the data. In PowerShell it’s already done for you and it’s fast. There are tons of commands like that in PowerShell.

    In PowerShell I’m not limited to just PowerShell. I can call an existing perl script or PowerBasic console command and capture the output into an object. So PowerShell is sort of like command central where I can easily orchestrate the interaction of diverse technologies.

  7. GUIs implemented via Powershell scripts are soooo needed. I always hated that I couldn’t get the same from Windows Scripting Host. The great part is to just be able to slap a GUI together in script and not have to deal with the structure and overhead of Visual Studio when you need something simple; dynamic languages ROCK!

    Although I’m not a “power” Powershell user, I am a programmer and definitely appreciate it. Actually, if I had to pick my favorite *language* it would be Powershell (used to be Python), and I definitely consider myself to be a developer and *not* an IT person.

    What can a developer do with Powershell? Lots of things but most recently I needed to batch rename thousands of files, and I needed to do it using lots of different logic. So I divided and conquered; I created a directory select to match a set of files and then ran a one-liner to rename each set, continuing until I had all them renamed. As an aside, the files I needed to rename were images for use on a website I’m working on (that is written in PHP and will be running on Linux, Apache, and MySQL!)

    My only complaint about Powershell is that I can’t use it to develop web apps (w/o having to go build my own framework, which I don’t have time to do.)

  8. WPF — still the heavyweight champion in the .NET world of frameworks and working set (and GPU and machine requirements) — feels wrong to be paried with a shell script. I know they’re trying to improve things, and there are some nice things that are possible (although many are easy to do in WinForms) … still feels wrong.

    I’m not saying Powershell isn’t useful. It certainly is for some (again, hasn’t been for me) ….

    I’m happy that Microsoft is enabling this path for you and the others. It shouldn’t be a substitute for a full GUI application calling cmdlets or any similar API (object model) for controlling, etc.

    I’m sure some will disagree, but I believe Microsoft needs to make sure they don’t spread themselves too thin trying to address to many problems, without spending the proper amount of time concentrating on the bigger issues facing their customers — both enterprise and consumers.

  9. […] series and are "asking WTF?".  Arron 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 […]

Comments are closed.