POSTS

MTS 07 - PowerShell Basics

Jim Truher, Product Manager of PowerShell.

MS has a new shell called PowerShell. There's new CLI tools, a scripting language, C# can be written interactively in the shell a la console.

They've redefined the text paradigm to an object-based one. Or that's the contention at the start. Their smaller commands are called "Cmdlets" (pronounced Commandlets). As Jim says it, it sounds like "our commandments" :-)

The definition of a cmdlet is a built-in function (cd, cat, etc.) in bash. They can be built in C# and then compiled into an installable cmdlets. Argument handling is built-in through some sort annotation style mark-up. Definitely a nice addition for anyone who's written a CLI script.

It now allows the basic type shell usage. His shell is setup to mimic a *nix shell with aliases to `ls`, etc.

The geeky stuff in this is code that does things like:

PS>$a = get-ipconfig;
PS>$a[0].hostname
travis-laptop

Anything you can do with C# you can do in the powershell. It's definitely a nice paradigm. It'll allow you to store custom objects in addition to the built-ins. You can't share objects between PS sessions directly, though you could serialize them and share them for data, but the actual object and methods won't exist there.

They don't allow you a su type command to elevate privileges which seems kind of weird. I'm not the only one that thinks that way either.

I think the presentation has elevated the geek status of all of us. The fact that we've had a ton of questions about shell access - I mean, wow. :-)

This does seem interesting and is something I'll probably have to install on my XP install and see how it works. Jim's talking about the target audience: guys from *nix backgrounds that get frustrated in Windows cause it's so hard to make it do what you want - i.e., the guys like me that install Cgywin. :-) If they're really interested in tackling that market, they'll try to do it port it to the *nix platform so it can be used there in place of bash/sh/etc.

Of all of the things I've seen so far, this one is the best in terms of advances by Microsoft compared to where their shells have been. Jim was asked about porting PS to another platform, and he didn't see it as something they'd focus on.

Update: Jim was asked about porting it to *nix and didn't see that as something Microsoft would invest the time in. Every person I talked to after the fact seemed to agree that porting PS to *nix was a certain way to remove the "I can't do anything in Windows" barrier for sys-admins. Having a shell that's as powerful as this available to install on RHEL or Ubuntu would get some uptake which gets people using the same tool they can use on Windows. That also starts programmers down the .NET road as they start using the C# that's available to them on the command-line and then scripts turn into programs and new .NET programmers are born.

Seems like they'd be shooting themselves in the foot to not attempt a port.