PowerShell v2 CTP is Out

The PowerShell has released the v2 CTP out into the wild.  Remember what I said earlier about evaluating this on either a throw away test PC image or a Virtual PC image.  You can get the bits from the link in this PowerShell Team blog post about v2 CTP.  There is a lot to like in this release like support for remote management and background jobs (oh I like these).  But there are some small things that are also really nice e.g.:

PS> 1TB
1099511627776

PS> 1PB
1125899906842624

PS> "a","b","c" -join ‘;’
a;b;c

PS> $env:path -split ‘;’
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\Program Files\Microsoft SQL Server\90\Tools\binn\
C:\WINDOWS\system32\WindowsPowerShell\v1.0\
C:\Bin
C:\Program Files\PowerShell Community Extensions
C:\Program Files\PowerShell Community Extensions\Scripts

# Splatting operator to map array items to individual parameters
PS> function add($a, $b, $c) { $a + $b + $c }
PS> $parms = 1,4,9
PS> add @parms
14

And for one of my favorite new enhancements – Select-String -AllMatches:

PS2> $pattern = ‘GET /ongoing/When/\d{3}x/(\d{4}/\d{2}/\d{2}/[^ .]+)’
PS2> Select-String $pattern –all *.log | Select -exp Matches | Group Value |
     Sort Count -desc | Select -first 10

There is also a -Context parameter on Select-String that will show you N number of strings (lines) before and after the selected string.  And for the "grep -v" lovers there is the -NotMatch parameter.  Nice.

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

One Response to PowerShell v2 CTP is Out

  1. Jeffrey says:

    RE: TB / PB
     
    I am SO glad we got that in. Its one of those things that we knew we should have done but it wasn\’t "bad enough" to fix in V1.  (Because at the end of the game, changes destablize the codebase so we have to get hard core about changes). 
     
    I like your example for -SPLIT – I\’m going to steal that one!
    Jeffrey Snover [MSFT]Windows Management Partner 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

Leave a Reply

Fill in your details below or click an icon to log in:

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