September 4th, 2013

PowerTip: Sort Objects Based on a Particular Property

Doctor Scripto
Scripter

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 

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.