PowerShell Team

Automating the world one-liner at a time…

Latest posts

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

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

Strict Mode: V1 Debug Tool V1 / V2 Best Practice

PowerShell Team

When we designed PowerShell we decided that we wanted to have Shell syntax and semantics because this is what was missing from the market and because it supports the ad hoc development practice that is so suited to the needs of administrators.  We also observed that most shells ran out of power pretty quickly and people had to throw away their scripts and start from scratch with a more powerfull scripting language like Perl.  Sadly, sometimes those environments ran out of power as well and people had to throw them away and start from scratch using a systems programming language like C++. ...

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

The Future Is Here Today

PowerShell Team

Would like to see what a PowerShell V2 world would look like?  If so, check out Jaykul Bennett's Select-Grid script HERE.  Here is what impresses me so much about this: Imagine hundreds, thousands, tens of thousands of other 200 line scripts with similar power.  Imagine people taking this base script and adding 10 more lines to to things just they way they need them to be.  The might not have been able to write the script from scratch but it is not that hard to add 10 lines to an existing script.Now imagine that have a graphics friend and you ask them to replace the WPF with something b...

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

PowerShell on WS08 Server Core!!!!

PowerShell Team

Superstar Dmitry Sotnikov has done the world a great service today by documenting how to get PowerShell running on WS08 Server Core HERE.  Just to be clear, this is  not a MSFT supported configuration.  That does NOT mean that we think it won't work.  What it means is that if it doesn't, you have to leverage the community to help you figure it out instead of Microsoft support. [Insert your favorite snarky remark here]  :-) As admins, it is just a simple fact of life that we have to color outside the lines to get our jobs done.   Yes - it would be best if we could ...

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

TIOBE: PowerShell on its way to the top 20 (Programming Languages)

PowerShell Team

The TIOBE Programming Community Index provides a monthy rating of the popularity of programming languages.  This month's headline was: PowerShell on its way to the top 20 I'm not sure how they rate popularity or how they came up with that title (given that right now we are at 36) but I liked the headline! Jeffrey Snover [MSFT]Windows Management Partner ArchitectVisit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShellVisit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

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

Doug Finke's Amazing 7 Minute C# => PowerShell Demo

PowerShell Team

Doug Finke has just posted a blog entry HERE with an awesome 7 minute video demo HERE.  I HIGHLY recommend this as a great use of 7 minutes of your life (or as Doug points out, you can type Ctrl-Shift-G to speed it up and it will be a great use of 4-5 minutes of your life :-) ) In the demo, he starts out writing and running some C# code. He then takes advantage of the new PowerShell V2 feature Add-Type to run this code from a PowerShell script.  Then, step by step, he transform the original C# code into PowerShell and ends up with a single line of PowerShell.  Each step produces a running PowerShel...

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

In Praise of TypeConverters – Spread the Love

PowerShell Team

I just got through reading Scott Hanselman's blog entry:  TypeConverters: There's not enough TypeDescripter.GetConverter in which he referenced  Jesse Liberty's blog entry: Did You Know That... Type Converters allow you to use property attributes in Complex Types and decided to pile on. Developers - you should stop what you are doing and get TypeConverters in focus.  Here is the big picture way to think about it:  As developers, our mission in life is to make the lives of others easier by providing them the functions they need in they way they need them.  TypeConverters play a huge role ...