Saturday, 10 November 2012

Get-Scripting Podcast Episode 32

This is Episode 32 of the Get-Scripting podcast. Tune in to listen to us talk and interview people about PowerShell.

Download it here, subscribe in iTunes or via a different feed reader.




PowerShell Deep Dive Book

PowerShell News:

Windows 8 / Server 2012 released, i.e. PowerShell v3!

Available for downlevel OSs.

Scripting IDE showdown / slowdown?

PowerShell Plus is now free:

PowerShell SE is no more?

PowerGUI no longer in development?

PowerShell ISE the way ahead?

PowerShell Summit - Session Announced


PowerShell Resources:

Get Regular Expression matches (DNS)

PowerScripting - the wives special

PowerShell Tip

Insert String Every N Characters

This PowerShell v2 script inserts a string every N characters. The interval is specified using the regex repetition operator, {min,max}.
$a = 'abcdefghijklmnopqrstuvwxyz'
([regex]::matches($a, '.{1,3}') | %{$_.value}) -join ' '
([regex]::matches($a, '.{1,8}') | %{$_.value}) -join '..'
([regex]::matches($a, '.{1}') | %{$_.value}) -join '-'

abc def ghi jkl mno pqr stu vwx yz

Removal of $_ and also $PSItem in PS v3

In PowerShell, the variable "$_" has special importance. It works like a placeholder in scenarios like this one:
PS> Get-ChildItem $env:windir | Where-Object { $_.Length -gt 1MB }
In PowerShell v3, there is an alias for the cryptic "$_": $PSItem. So now code can become more descriptive:
PS> Get-ChildItem $env:windir | Where-Object { $PSItem.Length -gt 1MB }
Then again, in PowerShell v3, "$_" isn't necessary in many scenarios anymore at all. You could also write:
Get-ChildItem $env:windir | Where-Object Length -gt 1MB


Send us feedback at

get [dash] scripting [at] hotmail [dot] co [dot] uk

or leave a comment here on the blog

Follow us on Twitter and join our Facebook Group

Get-Scripting Facebook Group

Extensive list of Powershell Twitterers