Skip to content

Instantly share code, notes, and snippets.

@aaronlake
Last active March 14, 2016 18:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronlake/88ff6aea1f179cb20483 to your computer and use it in GitHub Desktop.
Save aaronlake/88ff6aea1f179cb20483 to your computer and use it in GitHub Desktop.
Get Windows system information
$Computers = "localhost anotherhost01 yetanother01"
Clear-Host
foreach ($Computer in $Computers)
{
$computerSystem = get-wmiobject Win32_ComputerSystem -Computer $Computer
$computerBIOS = get-wmiobject Win32_BIOS -Computer $Computer
$computerOS = get-wmiobject Win32_OperatingSystem -Computer $Computer
$computerCPU = get-wmiobject Win32_Processor -Computer $Computer
$computerHDD = Get-WmiObject Win32_LogicalDisk -ComputerName $Computer -Filter drivetype=3
write-host "System Information for: " $computerSystem.Name -BackgroundColor DarkCyan
"-------------------------------------------------------"
"Manufacturer: " + $computerSystem.Manufacturer
"Model: " + $computerSystem.Model
"Serial Number: " + $computerBIOS.SerialNumber
"CPU: " + $computerCPU.Name
ForEach ($HDD in $computerHDD){
"HDD Capacity: " + "{0:N2}" -f ($HDD.Size/1GB)
"HDD Space: " + "{0:P2}" -f ($HDD.FreeSpace/$HDD.Size) + " Free (" + "{0:N2}" -f [math]::Round([string]($HDD.FreeSpace -as [decimal])/1024/1024/1024) + "GB)"
}
"RAM: " + "{0:N2}" -f [math]::Round([string]($computerSystem.TotalPhysicalMemory -as [decimal])/1024/1024/1024) + " GB"
"Operating System: " + $computerOS.caption + ", Service Pack: " + $computerOS.ServicePackMajorVersion
"User logged In: " + $computerSystem.UserName
"Last Reboot: " + $computerOS.ConvertToDateTime($computerOS.LastBootUpTime)
""
"-------------------------------------------------------"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment