Easier ForEach/Where-Object in PSv3

by Jun 28, 2012

In the upcoming PowerShell v3 which you can already download as a Beta version, using Where-Object and ForEach-Object becomes a lot simpler. No longer do you need a script block and code. This, for example, is all you need to find files larger than 1MB:

PS> Get-ChildItem $env:windir | Where-Object Length -gt 1MB

Previously, you would have had to write:

PS> Get-ChildItem $env:windir | Where-Object { $_.Length -gt 1MB }

Twitter This Tip! ReTweet this Tip!