Last active
March 14, 2016 18:10
-
-
Save aaronlake/88ff6aea1f179cb20483 to your computer and use it in GitHub Desktop.
Get Windows system information
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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