PowerShell: Read Computer Information

Sometimes, I need to check the information of a list of servers. To get it done just in one shot, script is my best choice.

Here is a example to check my local machine’s info:

$Machine = “localhost”

$OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Machine
$CS = Get-WmiObject -Class Win32_ComputerSystem -ComputerName $Machine
$CPU = Get-WmiObject -Class Win32_Processor -ComputerName $Machine

Write-Host “Model:” $CS.Manufacturer $CS.Model
Write-Host “Processor:” $CPU.Name
Write-Host “Memory:” ($CS.TotalPhysicalMemory/1024000000) “G”
Write-Host “Operating System:”$OS.Caption $OS.OSArchitecture
Write-Host “Service Pack Version:” $OS.servicepackmajorversion

The results come out like this:

Model: Hewlett-Packard HP EliteBook 8440p
Processor: Intel(R) Core(TM) i5 CPU       M 580  @ 2.67GHz
Memory: 3.98066 G
Operating System: Microsoft Windows 7 Professional  64-bit
Service Pack Version: 1


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s