get-scripting

Get-Scripting Podcast Episode 32

11.10.2012 - By Play

Download our free app to listen on your phone

Download on the App StoreGet it on Google Play

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. Intro: Alan: Jonathan: PowerShell Deep Dive Book PowerShell News: Windows 8 / Server 2012 released, i.e. PowerShell v3! Available for downlevel OSs. http://www.microsoft.com/en-us/download/details.aspx?id=34595 Scripting IDE showdown / slowdown? PowerShell Plus is now free: http://www.idera.com/Free-Tools/PowerShell-Plus/ PowerShell SE is no more? http://powerwf.com/products/powerse.aspx PowerGUI no longer in development? PowerShell ISE the way ahead? PowerShell Summit - Session Announced http://poshoholic.com/2012/11/02/powershell-summit-community-sessions-list/ UKVMUG http://www.vmug.com/p/cm/ld/fid=212 PowerShell Resources: Get Regular Expression matches (DNS) http://enterpriseadmins.org/blog/scripting/get-regular-expression-matches/ PowerScripting - the wives special http://powerscripting.wordpress.com/2012/05/28/episode-187-teresa-scriptingwife-wilson-and-staci-halswife-rottenberg/ PowerShell Tip Insert String Every N Characters http://blog.expressionsoftware.com/2010/03/insert-string-every-n-characters.html 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 '-' #output abc def ghi jkl mno pqr stu vwx yz abcdefgh..ijklmnop..qrstuvwx..yz a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z 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 Feedback 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 http://twitter.com/getscripting http://twitter.com/jonathanmedd http://twitter.com/alanrenouf Get-Scripting Facebook Group Extensive list of Powershell Twitterers

More episodes from get-scripting