Forum Discussion

Petri-X's avatar
Petri-X
Bronze Contributor
Aug 21, 2019
Solved

How to sort when using custom tables

Hi I have a registry hives where I have same information on all of them. I would like to read the values from all of those hives, and then sort output based on the values.   Here I have simple exa...
  • VasilMichev's avatar
    Aug 21, 2019

    That's because you are using Format-Table. Use a simple Select instead.

     

    Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services -Depth 0 | Select @{Label="Services"; Expression={(Get-ItemProperty -Path $_.PSPath).DisplayName}}, @{Label="Start"; Expression={(Get-ItemProperty -Path $_.PSPath).Start}} | sort Start -Descending