I am trying to format a PSObject related to a question a few days back. My object looks like this:
New-Object PSObject -Property @{
"Version"= $winVersion.Caption
"Processor Name" = $processorInfo.Name
"Processor Manufacturer" = $processorInfo.Manufacturer
"Processor Max Clock Speed" = $processorInfo.MaxClockSpeed
} |format-list
The above gives the following output:
Processor Manufacturer : GenuineIntel
Processor Max Clock Speed : 2201
Version : Microsoft Windows 8 Pro
Processor Name : Intel(R) Core(TM) i7-2670QM CPU @ 2.20GHz
However, this:
New-Object PSObject -Property @{
"Windows Version"= $winVersion.Caption
"Processor Name" = $processorInfo.Name
"Processor Manufacturer" = $processorInfo.Manufacturer
"Processor Max Clock Speed" = $processorInfo.MaxClockSpeed
} |format-list
gives the following output:
Processor Manufacturer : GenuineIntel
Processor Max Clock Speed : 2201
Processor Name : Intel(R) Core(TM) i7-2670QM CPU @ 2.20GHz
Windows Version : Microsoft Windows 8 Pro
Not really a big deal, but I wonder why the formatting changes? It does not seem to be alphabetical in any way. Furthermore, I tried sorting the object with Sort-Object (from A-Z) but to no avail. Is it String related?