Get-CimInstance
Query system details (WMI/CIM)
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object Caption, Version, LastBootUpTime
- Works on
- Windows
- PowerShell
- 5.1 and later
- Reference
- Microsoft Learn: Get-CimInstance
CIM (the modern face of WMI) is Windows' built-in database of system facts: serial numbers, BIOS, disks, uptime, installed updates. Get-CimInstance reads it.
It replaces Get-WmiObject, which was removed in PowerShell 7. The old wmic tool is being removed from Windows too.
Try this
Get-CimInstance -ClassName Win32_BIOS | Select-Object Manufacturer, SerialNumber
Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object Manufacturer, Model, TotalPhysicalMemory
Get-CimInstance -ClassName Win32_QuickFixEngineering | Sort-Object InstalledOn -Descending | Select-Object -First 5
LastBootUpTime from the command at the top tells you when the computer last restarted.
Coming from another shell
| Shell | What you might type |
|---|---|
| cmd.exe | wmic os get caption,version,lastbootuptime |
More in From bash and From cmd.