DCSIMG
Measure - Shay Levy

Shay Levy

If you repeat it, PowerShell it!

News


btn_donate_LG

View Shay Levy's profile on LinkedIn Follow Shay Levy at Twitter Shay Levy's Facebook profile Subscribe to my FriendFeed


site statistics




Browse by Tags

All Tags » Measure (RSS)
Measuring objects in PowerShell 3.0
The Measure-Object cmdlet gives us a great way to find minimum and maximum values in a collection of objects. For example, if we want to know the smallest and largest size of a file in the current directory: PS> Get-ChildItem | Measure-Object -Property Length -Minimum -Maximum Count : 2751 Average : Sum : Maximum : 56297240 Minimum : 35 Property : Length In PowerShell 2.0 it only worked with numeric properties (integers), we couldn't use it to compare properties like LastWriteTime (DateTime...
Select and then Sort
When you use both select-object and sort-object in a pipeline, what's the proper order? Let's check how fast they execute. Each speed test is built from two similar commands with a different sort/select piping order and each test is executed 10 times. The total execution time is measured in Milliseconds. - Updated: 06/11/2008 (see comment below by Lee Holmes ) - Test #1 PS > (measure-Command { 1..10 | foreach { gsv | sort name | select name,status }}).TotalMilliseconds 444.5451 PS >...