Forum Discussion
Petri-X
Aug 21, 2019Bronze Contributor
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...
- 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
VasilMichev
Aug 21, 2019MVP
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 -DescendingPetri-X
Aug 22, 2019Bronze Contributor
Big thanks VasilMichev !
Now I have learnt once more something new 😄