Get sizing informations on a remote computer with PowerShell

Hello,

Today, we want to retrieve the number of logical processors, the amount of ram and the number of ram physical slot used. To achieve our goal, we’ll use WMI :

First, we use the “Win32_ComputerSystem” :

Get-WmiObject Win32_ComputerSystem -ComputerName SQL

Gwmi-CS

If you pipe that in a “Get-Member“, you’ll find more properties, such as those :

Gwmi-CS-Selected

If you want the total amount of ram in a readable form, you’ll use a dictionary :

Gwmi-CS-SelectedConverted

Then, the “Win32_PhysicalMemory” :

Get-WmiObject Win32_physicalmemory -ComputerName SQL

If you pay attention, you’ll notice that this query returned several objects. Indeed, you have one object by used slot, so, you just need to count them to know how many slot are used:

Gwmi-Memory

You can have some informations about each used slots such as :

Gwmi-MemorySelected