Feelings of White   this is where something witty goes
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
  • violent aggression
  • 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 Awesomeness

  • Watching Oprah
  • The Worst Day
  • peanut butter & bees
  • Cook it yourself
  • VA#7 Violent Aggression Overthinks Sodomy
  • Lost Untangled
  • Homunculus
  • VA#6 Violent Aggression vs. Decency
  • Bring Back The Silk Pie!
  • More to follow
  • Ken Melnichuk
  • Scary fucking shit; the pictures
  • Scary fucking shit
  • Unsold Pilot
  • VA#5 Violent Aggression vs. The Racist Candy

Find things tagged

4400 Battlestar Galactica Battlestar Galactica cliff comics curation depression erron family fiction food game janine job kelly kyle liam lost manifesto meta mlp music nathan passionate diatribes plug poem politics Really Dumb Story relationships review revisionism sam sermon software spirituality star trek Star Trek Deep Space Nine suicide tamdhu testpoint the process travels video vlad wtf

Other Opinions

  • Cliff on Watching Oprah
  • Erron on Cook it yourself
  • Erron Anderson on The Worst Day
  • Tammy on Cook it yourself
  • Legion on Cook it yourself
  • Tammy on The Worst Day
  • Cliff on The Worst Day
  • Chad on The Worst Day
  • Cliff on The Worst Day
  • Cliff on Cook it yourself
  • Tammy on peanut butter & bees
  • Chad on peanut butter & bees
  • Tammy on Cook it yourself
  • Chad on Cook it yourself
  • Stephen on Good Goddamn, Powershell Sucks!

Friends of White

  • The Ack Attack is bringing Lost & BSG awesomeness direct to your brain!
  • Peer Pressure Works to bring you football, rants, politics and kittens
  • What's Alan Watching is your television addiction
  • Jammer's Reviews provides insight into BSG and Star Trek
  • The Grind is a pixelrific exploration of WoW addiction and more
  • In The Now touched me inappropriately with its writing
  • Analog Coast amalgamates many blogs into one and lately some original content has washed ashore

What was I doing in..

  • July 2010 (4)
  • June 2010 (1)
  • May 2010 (2)
  • April 2010 (2)
  • January 2010 (1)
  • December 2009 (4)
  • November 2009 (2)
  • October 2009 (1)
  • August 2009 (2)
  • July 2009 (2)
  • June 2009 (1)
  • May 2009 (1)
  • April 2009 (3)
  • March 2009 (11)
  • February 2009 (6)
  • January 2009 (10)
  • 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 © 2009 Feelings of White | Powered by WordPress | Original site design by Stephen Reinhardt; tweaked by me