Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 1.0 » Sort-Object

Sort-Object - Powershell 1.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Sort-Object

Description
Sort objects by property value

Usage


Options


Example(s)
List the files in the current directory and sort using the default order (alphabetical by Name):

PS C:\>get-childitem | sort-object

List the files in the current directory and sort by date/time:

PS C:\>get-childitem | sort-object -property LastWriteTime

List the files in the current directory and sort in descending order by the time span between CreationTime and LastWriteTime:

PS C:\>get-childitem *.* | sort-object @{Expression={$_.LastWriteTime-$_.CreationTime}; Ascending=$false} | select-object LastWriteTime, CreationTime