Feelings of White   brought to you by gange green… it’s not just for wars!
Me, looking like Hot Sex inc. with my cool shades, a beer and my bountiful chest hair displayed for all to see
  • all
  • curator's pick
  • funny
  • narcissism
  • technical
  • the arts
  • the void
  • writing

My First PowerShell

The PowerShell team once requested everyone to blog your initial powershell experiences, and after a personal appeal, how can I refuse! I thought maybe enough time had passed that they weren't interested. (maybe I'll even get more ego boosting posts. Can I believe stuff like that? I'm new to blogs. But it's a fun thought)

I was already a big .Net fan and had heard (but forgotten) about PowerShell until our IT guy suggested it for a problem I was having. The hype was promising (object manipulation instead of string parsing! egads!). I read lots, the install was simple and I started playing around. After a few days I forced myself to switch my always-on shell window to PowerShell instead of cmd.exe.

The manuals that came were helpful to start, although I learned most of the basics from online articles. I wish a more complete user manual (that had syntax examples of scripts for example) would come by default. It feels like the product shipped without help. Although, the get-help command within PowerShell is fantastic. You guys did an awesome job with the contents of get-help.

As a asp.net developer I was more interested in the file-manipulation stuff that could help us with out daily build and .net1.1 -> 2.0 migration. Within less then 2 day I switched us from .bat files to .ps1 files, PowerShell was that good. It saved me time and gave me new options almost instantly. It was the reason I first started this blog.

I love that everything is .Net objects, I love the piping of commands ala unix. It's like being able to work with sql-like commands (ie, set operations) but with any .net object -- fantastic! It scaled from quick & dirty admin-style scripts to full programatic logic control features, exceptions.

And so perl like. Ugh. That took me a while to get over. Why is the command "." instead of a descriptive "include" keyword? to continue the glorious cryptic command-line traditions?

Oh, and the biggest headache I've had thus far? Calling existing command-line tools from powershell. Passing parameters with spaces always seems to break things as PowerShell interprets variables it's way, instead of the way my mental-model expects them too. Which, I guess, is more .bat file like; expecting environment variable-expansion. So, given that you've got a file called listparams.bat:

echo parameters were %*

and the command

.\listparams.bat -buildfile:hi.txt

in cmd.exe, it yeilds

parameters were -buildfile:hi.txt

but in Powershell.exe it yields

parameters were -buildfile: hi.txt

notice the space in the output.

These subtle differences are very frustrating. This particular example is painful when using nant and it's -buildfile: parameter.

Overall I like PowerShell though. Fan-frakking-tastic.

2007 Jan 16 1:57 am; Filed under powershell .
« Pithy PowerShell « before «
» after » Look what you can do in PowerShell »
  1. Jeffrey Snover on 2007 Jan 16

    Thanks. This is helpful.

    Jeffrey Snover [MSFT]
    Windows PowerShell/MMC Architect
    Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell
    Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

Posting your comment.
Follow responses with this post's comment feed.

Leave a reply

Subscribe

Recent Posts

  • Bootstrapping Baby
  • Basic Math
  • Jimbo vs. The Tooltip
  • Why I’m Throwing Away My Vote
  • Comics You Must Read! #1
  • The Shit Dancer [Tamdhu Stories 1.3]
  • Money & Other Friends [Tamdhu Stories 1.2]
  • Betty the Gas-Whore [Tamdhu Stories 1.1]
  • Command Line Parsing using Attribute Decoration in .NET
  • We Are Metallica
  • The Best of Projects: Fiction [3 of 3]
  • Good goddamn, Galactica Roxxors With Coxx Out
  • BSG 4×07 - Guess What’s Coming to Dinner?
  • WordPress plugin: Apply a CSS class defined in a post’s custom field
  • The Best of Projects: Autoserious [2 of 3]

Recent Comments

  • Uncle Henri on Bootstrapping Baby
  • Uncle Henri on Bootstrapping Baby
  • legion on Bootstrapping Baby
  • Michelle on Bootstrapping Baby
  • Erron on Bootstrapping Baby
  • Steven on Bootstrapping Baby
  • Cliff on Bootstrapping Baby
  • Liam on Bootstrapping Baby
  • Shaun on Bootstrapping Baby
  • Kyle on Bootstrapping Baby

Tags

4400 bsg cliff comics curation depression ds9 erron family fiction game janine job kelly kyle liam lost manifesto meta mlp music passionate diatribes plug plugin poem powershell rds relationships review revisionism sam sermon software spirituality star trek suicide tamdhu testpoint the process travels video vlad wacky walkabout wtf

Archives

  • December 2008 (3)
  • October 2008 (1)
  • August 2008 (2)
  • July 2008 (3)
  • June 2008 (1)
  • May 2008 (11)
  • April 2008 (7)
  • March 2008 (3)
  • February 2008 (1)
  • January 2008 (2)
  • December 2007 (1)
  • October 2007 (1)
  • September 2007 (3)
  • August 2007 (1)
  • June 2007 (3)
  • May 2007 (2)
  • March 2007 (5)
  • February 2007 (5)
  • January 2007 (13)
  • September 2006 (1)
  • June 2001 (3)
  • May 2001 (2)
  • April 2001 (2)
  • March 2001 (2)
  • February 2001 (1)
  • January 2001 (1)
  • November 2000 (5)
  • May 2000 (3)
  • April 2000 (5)
  • March 2000 (3)
  • February 2000 (3)
  • January 2000 (6)
  • December 1999 (17)

Copyright © 2008 Feelings of White | Powered by WordPress | Designed by Stephen Reinhardt; tweaked by me