PowerShell for Windows Admins

Jul 1 2010   12:54PM GMT

Computer System Information



Posted by: Richard Siddaway
PowerShell v2, WMI

The basic information on your system – name, model, CPUs and RAM can be easily obtained

001
002
003
004
005
Get-WmiObject -Class Win32_ComputerSystem | 
Format-List Name, Manufacturer, Model, 
SystemType, Description,
NumberOfProcessors, NumberOfLogicalProcessors,
@{Name="RAM"; Expression={[math]::round($($_.TotalPhysicalMemory/1GB), 2)}}

use the Win32_Computersystem class and select the relevant properties.  Only new bit is using the round method of System.Math to round the result of converting the memory from bytes to GB. The 2 represents the number of decimal digits I want

Comment on this Post

Leave a comment: