1

I've created this PS hastable for computer hardware:

$PCHardware = @{
    CPU = (Get-CIMInstance Win32_Processor).Name
    RAM = "$((Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory /1gb | % { '{0:0.##}' -f $_})"+"GB"
    Disk = (Get-CimInstance Win32_DiskDrive).model
    GPU = (Get-CimInstance Win32_VideoController).name
    Motherboard = (Get-CIMInstance Win32_BaseBoard).product
}

The problem I'm facing is that instead of this:

Name Value
CPU Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
RAM 15.96GB
Disk SAMSUNG MZVLV256HCHP-00000
GPU NVIDIA Quadro M2000
Motherboard Z270M Extreme4

I get this:

Name Value
GPU NVIDIA Quadro M2000
CPU Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
RAM 15.96GB
Disk SAMSUNG MZVLV256HCHP-00000
Motherboard Z270M Extreme4

What sorting rules does the Hashtable follow? Is not alphabetical by "Name" nor alphabetical by "Value".

Is there a way for it to follow my constructor format?

Thanks.

francisco.l
  • 306
  • 1
  • 12

0 Answers0