Lessons Learned

My drop-site for interesting snippets and tips. If it's useful to you as well, great!

Browse by Tags

Tagged Content List
  • Blog Post: PowerShell Gotchas: Looping with $null

    For some obscene reason, PSHv1 will gladly iterate with a $null as an array element in Foreach. @( $null , 1, $null , 2) | Foreach { "'$_'" ; } '' '1' '' '2' So, in the name of defensive programming, I've taken to manually testing for this case: @( $null , 1, $null , 2) | Foreach { if ( ...
Page 1 of 1 (1 items)