Windows PowerShell 1.0 DeskSheet

The WPS documentation pack comes with a Windows PowerShell Language Quick Reference in the form of ‘a handy, one-page foldable guide’. It’s a great guide, but the format didn’t suite me so I’ve summarised the Quick Reference into a DeskSheet.

There are now three DeskSheets available for download:

  1. Windows PowerShell 1.0 DeskSheet
  2. SQL Server 2005 Query DeskSheet (still working on the Programming DeskSheet!)
  3. Visual Studio Team & MSBuild DeskSheet

My experience with PowerShell is still limited, so I fully expect to revise the PowerShell DeskSheet in the coming months… FTD

Advertisements
This entry was posted in Windows PowerShell. Bookmark the permalink.

11 Responses to Windows PowerShell 1.0 DeskSheet

  1. Jeffrey says:

    Welcome the PowerShell community!  Please do us a favor and blog the good, the bad, and the ugly of your initial experiences.  This information is extremely helpful to us.
     
    http://blogs.msdn.com/powershell/archive/2007/01/06/blog-your-initial-powershell-experiences.aspx
     
    BTW – I\’m very eager to see how your work with MSBUILD and PowerShell goes.
     
    Cheers!
     
    Jeffrey Snover [MSFT]Windows PowerShell/MMC ArchitectVisit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShellVisit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

  2. Keith says:

    I love this sort of cheat sheets.  They really help folks new to PoSH.  I do have a few suggestions to make this better though.  I think the explanation of the operators "()" aka grouping, "$()" aka subexpressions and "@()" aka array subexpressions could be better.  For instance the primary raison d\’etre for array subexpression guarantees that you will get an array even for a scalar result e.g. @(gal wh*) will return an array with one element in it (unless you have another custom alias that starts with wh).  What you currently have in the subexression example $(Get-Alias a*) could just as easily be done in a grouping expression (Get-Alias a*).  What sets the subexpression apart is that you can execute multiple statements in it $(Get-Alias a*; Get-Process w*) whereas in a grouping expression, you can only execute a single statement.  Grouping expressions also start a new parsing context.  So if you start  a command line like so:
     
    > AddNumberFunction
     
    You are in command mode where it would treat an argument like 2+2 as a string but when it sees:
     
    > AddNumberFunction 6 (2+2)
    10
     
    the opening paren of (2+2) will kick PoSH into expression parsing mode and eval the expression to 4 and then pass that to the function along with the argument 6.

  3. Keith says:

    Let me rephrase that explanation of @(gal wh*).  What I mean to say is that it doesn\’t matter whether "gal wh*" returns a single value (scalar result) or multiple values (array result) the array subexpression will guarantee that you always get an array output.  In the case of the array result the use of @() is effectively a no-op. However in the case of the scalar result, the @() will create a 1d array with one value in it.  If there is "no" output generated from the code inside the @() then a 1d array with no elements (count -eq 0) will be created.

  4. Mike says:

    Keith, thanks for the feedback. I will work it into my first revision of the DeskSheet.
     
    Jeffrey, I\’ll probably be getting to the MSBuild – PowerShell integration stuff in a couple weeks. I\’ll be doing regular posts on this and PS in general when I get my teeth into the product.
     
    Regards…FTD.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s