PowerTip: Sort Objects Based on a Particular Property

Doctor Scripto

Dr Scripto

Summary: Learn how to use the Sort-Object Windows PowerShell cmdlet to sort on a specific property.

Hey, Scripting Guy! Question How can I sort a collection of Windows PowerShell objects without using the default property?

Hey, Scripting Guy! Answer Use the –Property parameter and specify the name of the property to sort on:

get-childitem | sort-object -property length 

Doctor Scripto
Dr Scripto

Scripter, PowerShell, vbScript, BAT, CMD

Follow Dr Scripto   

0 comments

    Leave a comment