"Sort-Object" Cmdlet in Windows PowerShell

Q

What is the "Sort-Object" cmdlet in Windows PowerShell?

✍: FYIcenter.com

A

"Sort-Object" cmdlet in Windows PowerShell takes an input of object list and generate an output object list by sorting objects according to specified properties.

For example, the following command uses the "sort-object" cmdlet to sort a Process object list by the CPU property:

PS C:\fyicenter> get-process | sort-object -property CPU

Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName
-------  ------    -----      ----- -----   ------     -- -----------
     33       1      344        452     3             308 smss
    353       9     8604       7804    50             588 services
   1125      38    55008      30004   252            6740 SearchIndexer
    453       9     8156       7144    50             832 svchost
    417       8     5128       4684    57             712 svchost
    528      17    11600       9160   104            1920 spoolsv
    156       6    16016       1328   123            2380 PresentationFontCache
...

 

Introduction of Windows PowerShell Cmdlet

⇒⇒Windows PowerShell Tutorials

2016-11-04, 383👍, 0💬