PowerTip: Sort Objects Based on a Particular Property

Doctor 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 


Discussion is closed.

Feedback usabilla icon