How to Check Your PC Hardware with PowerShell (Get-CimInstance)

Someone asks "how much memory does this PC have?" and you open Settings, then Task Manager, then hunt for the label under the laptop. On one machine, fine. On fifteen, it eats the afternoon. Windows already stores the model, serial number, BIOS version, memory modules and graphics card in WMI, and Get-CimInstance reads all of it in one line.
What is Get-CimInstance
It is the CimCmdlets cmdlet that queries CIM/WMI classes. According to the Microsoft documentation, it returns instances of a class from a CIM server, and without -ComputerName or -CimSession it queries local WMI. It replaces the old Get-WmiObject, which does not exist in PowerShell 7. It works in Windows PowerShell 5.1 and 7.x, but only on Windows.
Most of the classes below do not need administrator rights.
How do I see my PC specs in PowerShell?
Run Get-CimInstance -ClassName Win32_ComputerSystem for manufacturer, model and total RAM, and Win32_BIOS for the serial number and BIOS version.
Every piece of hardware is a class. The ones I use most:
- Win32_ComputerSystem: manufacturer, model, total physical memory.
- Win32_BIOS: serial number, BIOS version and date.
- Win32_Processor: CPU name, cores, threads, max clock.
- Win32_PhysicalMemory: one object per RAM module.
- Win32_VideoController: graphics card and driver version.
- Win32_OperatingSystem: edition, Windows build and last boot.
Step 1: identify the machine
Get-CimInstance -ClassName Win32_ComputerSystem |
Select-Object Manufacturer, Model, @{n='RAM_GB';e={[math]::Round($_.TotalPhysicalMemory/1GB,1)}}
Get-CimInstance -ClassName Win32_BIOS |
Select-Object SerialNumber, SMBIOSBIOSVersion, ReleaseDateThe BIOS SerialNumber is what the manufacturer's support asks for to check warranty. On a custom-built PC this field often holds generic text such as "To be filled by O.E.M.", because the motherboard has no system serial number written to it.
Step 2: processor and memory
Get-CimInstance -ClassName Win32_Processor |
Select-Object Name, NumberOfCores, NumberOfLogicalProcessors, MaxClockSpeed
Get-CimInstance -ClassName Win32_PhysicalMemory |
Select-Object BankLabel, DeviceLocator, Manufacturer, PartNumber, Speed,
@{n='GB';e={$_.Capacity/1GB}}The second query returns one row per module. It is the fastest way to find out whether a laptop has one 16 GB stick or two 8 GB sticks, and how many slots are used before you buy an upgrade. The PartNumber helps you buy a compatible module. Speed is in MHz.
Step 3: graphics card, with a catch
Get-CimInstance -ClassName Win32_VideoController |
Select-Object Name, DriverVersion, DriverDate, VideoProcessorDon't trust the AdapterRAM field for VRAM. The Win32_VideoController class documentation defines it as uint32, a 32-bit type that cannot represent values above 4 GB. On a modern card the number comes out wrong or truncated. For reliable VRAM, use dxdiag or Task Manager's Performance tab.
Step 4: one table to paste into a ticket
$cs = Get-CimInstance Win32_ComputerSystem
$bios = Get-CimInstance Win32_BIOS
$cpu = Get-CimInstance Win32_Processor | Select-Object -First 1
$os = Get-CimInstance Win32_OperatingSystem
[pscustomobject]@{
Computador = $env:COMPUTERNAME
Modelo = "$($cs.Manufacturer) $($cs.Model)"
Serial = $bios.SerialNumber
BIOS = $bios.SMBIOSBIOSVersion
CPU = $cpu.Name
RAM_GB = [math]::Round($cs.TotalPhysicalMemory/1GB,1)
Windows = "$($os.Caption) build $($os.BuildNumber)"
UltimoBoot = $os.LastBootUpTime
} | Format-ListThis report fits on one screen and replaces the hand-filled spreadsheet. Swap Format-List for Export-Csv to keep the result.
Step 5: inventory several computers
With -ComputerName, the cmdlet creates a temporary session over WS-Man. For several queries against the same machine, Microsoft recommends opening a CIM session and reusing it, which is faster:
$s = New-CimSession -ComputerName PC01, PC02, PC03
Get-CimInstance -ClassName Win32_BIOS -CimSession $s |
Select-Object PSComputerName, SerialNumber, SMBIOSBIOSVersion |
Export-Csv C:\Audit\inventario.csv -NoTypeInformation -Encoding UTF8
Remove-CimSession $sRemote access requires WinRM enabled on the target machines and an account with administrative rights on them. If the connection fails, test the port first with Test-NetConnection: WinRM listens on 5985 (HTTP) and 5986 (HTTPS).
Why this matters for security
Inventory is the foundation of any hardening effort. You can't protect what you don't know exists: an outdated BIOS version, an unsupported Windows build and a forgotten machine on the network all show up in this list. Combine it with the open ports audit and the services review to get the full picture of the machine.
To run the inventory every week without remembering, schedule the script with schtasks. And if the report shows a suspicious disk, the next step is checking SSD and HDD health with Get-PhysicalDisk.




Comments