Search notes:

Registry: Sorting of items

$null = new-item         -path HKCU:\Software\tq84-reg-sort-test

$null = new-itemProperty -path HKCU:\Software\tq84-reg-sort-test -name "xDEF"  -value  test
$null = new-itemProperty -path HKCU:\Software\tq84-reg-sort-test -name "x-abc" -value  test
$null = new-itemProperty -path HKCU:\Software\tq84-reg-sort-test -name "x.mno" -value  test
$null = new-itemProperty -path HKCU:\Software\tq84-reg-sort-test -name "x-PQR" -value  test
$null = new-itemProperty -path HKCU:\Software\tq84-reg-sort-test -name "xghi"  -value  test
$null = new-itemProperty -path HKCU:\Software\tq84-reg-sort-test -name "x JKL" -value  test
In cmd.exe, reg query shows the entries in the order in which they were created:
C:\> reg query HKCU\Software\tq84-reg-sort-test\
PowerShell shows the same order:
PS C:\> get-item HKCU:\Software\tq84-reg-sort-test | foreach-object { $_.property }
xDEF
x-abc
x.mno
x-PQR
xghi
x JKL
However, regedit.exe shows the entries sorted. Especially interesting is that hyphens are not considered for sorting:
Cleaning up
remove-item         -path HKCU:\Software\tq84-reg-sort-test  -recurse

Index