Feelings of White   i wish i had raped the monkey but what i did instead was good too
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 »
  • Jeffrey Snover

    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

blog comments powered by Disqus

Subscribe

Recent Awesomeness

  • Neurotic Dad
  • #8 VA vs. Brevity
  • Lost in the Epilogue
  • Jamie Oliver’s Food Revolution
  • I shoulda got a fake fingernail
  • How did this shit get started?
  • Feeding the dragon, or plant, or.. shit I’m out of time
  • Why are you eating so much soy and corn?
  • Cop Out
  • I’m A Stay At Home Dad!
  • Firefly & Serenity
  • The Kitchen of Zarro Boogs
  • America’s Got Talent FTW!
  • Steamed Salmon with Tomato Basil Couscous
  • Dream Stealers Like Me

Other Opinions

Sorry, I know colors suck, I will fix it sometime...

Find things tagged

4400 Battlestar Galactica Battlestar Galactica cliff comics curation depression erron family fiction food funny game janine job kelly kyle liam lost manifesto meta mlp music nathan passionate diatribes plug poem 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

What was I doing in..

  • March 2011 (2)
  • August 2010 (23)
  • 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