Joben.Rara.blogs(".NET")

There are two ways to write error-free programs; only the third one works.

January 2007 - Posts

PowerShell for Vista has shipped!

PowerShell for Vista has shipped.

http://blogs.msdn.com/powershell/archive/2007/01/29/windows-powershell-1-0-for-windows-vista.aspx

Some links to go

A powershell cheatsheet

http://blogs.msdn.com/powershell/archive/2007/01/24/powershell-cheat-sheet.aspx

A VirtualLab for PowerShell (Learn by doing)

http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?culture=en-US&EventID=1032314395&EventCategory=3

Posted: 01-31-2007 12:48 PM by velocity | with no comments
Filed under:
Cross posting PowerShell to Microsofts PH Forums

For anything PowerShell, I'll be crossposting this to Microsoft Philippines' Forums.

http://msforums.ph/forums/thread/181032.aspx

Windows PowerShell

What's this new "thing" that got so many people all hot and bothered in a way that only rivals getting up close and personal with Aubrey Wink? [My apologies to the babes]. Before the name change, it used to be called Monad but now they just call it PS. For something that was named after an abstract concept like metaphysical "atoms" -  what Leibnitz calls monads - powershell sure is "hot". Scott Hanselman has been blogging and podcasting about it. MySpace is using it to manage its more than 1,000 servers. Just search for "excited" and "powershell" and see just how many hits come up.

PowerShell is Microsoft's new scripting language. Version 1.0 is already released for Windows XP and Windows Server 2003. What makes PowerShell such a hot, new scripting language that makes people stand up and notice? First of all, let me talk to the *nix people, those who live and die in a command shell, who aren't afraid of "rm -r *" Stick out tongue. You won't need to go and grab cygwin just so you can grep your way around windows. PowerShell is a first class CLI (That's Command Line Interface to you Mort). You can ls your way around, even do a ps and kill a process. Pipe one command into another and you'll feel right at home. However, its not another rip off of *nix command line utilities. PowerShell is much more than just providing *nix like tools. First of all, what you pipe from one command to another is not text but first class objects. Yes, objects and not text. You get access to properties and methods and you'll never have to think about which column number you'll need to start "grabbing" so you can sort the results. The syntax is simple and consistent, following a verb-noun format like "get-process", "stop-process". And yet, you can create aliases so that "get-process" can be written as "ps". I love the idea of providers. Storage is abstracted into providers so you can "ls HKLM:\Software\Microsoft" into the registry just as easily as you can "ls c:\users". Most of all its extensible. If what you need is not available, use your coding smarts together with a little of .NET, you can create your own command and "snap-in" your new command to the CLI.

And if you're with Microsoft since birth, PowerShell is the Command Shell on steroids. No, there's no GUI to fiddle with. No F1 to display a help file. But there's "get-help" that you can type. You may set the alias F1 for "get-help" but I doubt if it'll be the same experience Stick out tongue. This is NOT an updated vbscript/jscript. It is brand, spanking new. From Microsoft's website, Microsoft Windows PowerShell command line shell and scripting language helps IT Professionals achieve greater productivity. Using a new admin-focused scripting language, more than 130 standard command line tools, and consistent syntax and utilities, Windows PowerShell allows IT Professionals to more easily control system administration and accelerate automation. Exchange Server 2007 is going to ship with a command line interface using PowerShell. You can automate the management of mailboxes, users, etc. Instead of going through dialog boxes and windows, you can just feed a list of users to a script and let PowerShell sweat while you're updating your fantasy nba lineup. (That takes awhile, you know)

How do you get started with learning PowerShell?

  1. Download PowerShell. http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx
  2. Read the "Getting started' guide. It comes with the download package.
  3. Follow the 4 pillars of discovery.
    • get-help
    • get-command
    • get-psdrive
    • get-member
  4. Go to the script center and try out some ready made scripts. http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx

Remember the "iloveyou.vbs" that made headlines? PowerShell has an execution policy that will restrict users from running unsigned scripts. You can sign scripts to secure your scripting environment from rogue scripts.

Over at codeplex.com, there's already 8 projects working on extending PowerShell. The powershell extensions community is coming up with additional cmdlets like

  • ConvertTo-MacOs9LineEnding
  • ConvertTo-UnixLineEnding
  • ConvertTo-WindowsLineEnding
  • Format-Hex
  • Get-Hash
  • Get-ShortPath
  • Send-SmtpMail

There's a lot more that can be said about PowerShell but for now, fire up your RSS readers and load up http://blogs.msdn.com/PowerShell/ for more.

Happy scripting.