################################################## # # Written by Ian Cammarata # Last Updated: 1:02 AM 3/29/2013 # ################################################## # # Usage: # Get-ComputerInfo < ip | computer name > # Ex: # Get-ComputerInfo 192.168.10.10 # ################################################## # # Notes: # -Monitor info requires Windows Vista or newer # -Thermal info requires admin rights # ################################################## $ErrorActionPreference = "SilentlyContinue" $lookupPC = "." IF ($args) { $lookupPC = $args[0] } IF ((Test-Connection -quiet -Count 1 $lookupPC) -eq $FALSE -AND $lookupPC -ne ".") { Write-Host -ForegroundColor RED "Could not resolve host name or PC not pingable." EXIT } $w32dd = Get-WmiObject -ComputerName $lookupPC Win32_DiskDrive $w32ddCIMV2 = Get-Wmiobject -ComputerName $lookupPC Win32_DiskDrive -namespace "root\CIMV2" $w32pm = Get-WmiObject -ComputerName $lookupPC Win32_PhysicalMedia $storageFailPredict = Get-WmiObject -ComputerName $lookupPC -Namespace root\wmi -Class MSStorageDriver_FailurePredictStatus $w32cs = Get-WmiObject -ComputerName $lookupPC -Class win32_computersystem $w32os = Get-Wmiobject -ComputerName $lookupPC Win32_OperatingSystem $w32b = Get-WmiObject -ComputerName $lookupPC -Class win32_bios $w32mon = Get-WmiObject -ComputerName $lookupPC -Class WmiMonitorID -Namespace "root/wmi" $therm = Get-Wmiobject -ComputerName $lookupPC MSAcpi_ThermalZoneTemperature -namespace "root/wmi" $thermFormat = @{Expression={$_.InstanceName};Label="Thermal Sensor";width=25},@{Expression={($_.CurrentTemperature / 10 - 273.15) / (5/9) + 32};Label="Temp. (Deg F)";width=15}, @{Expression={($_.CurrentTemperature)};Label="Temp. (Kelvins)";width=15} #Write-Host -ForegroundColor Black -BackgroundColor White "########################################################" #"" Write-Host -ForegroundColor Blue -BackgroundColor White "------------ Windows Info ------------" "Comp Name:`t" + $w32dd.SystemName "Domain:`t`t" + $w32cs.Domain "Win Vers.:`t" + $w32os.Caption "" Write-Host -ForegroundColor Blue -BackgroundColor White "------------ HDD Info ------------" for ( $i = 0; $i -lt $w32dd.length; $i++ ) { write-host "HDD Model:`t" $w32dd[$i].Model.Trim() write-host "HDD SN:`t`t" $w32pm[$i].SerialNumber.Trim() write-host "Size:`t`t" ([math]::round( $w32ddCIMV2[$i].Size / 1GB )) "GB" write-host "Predict Fail:`t" $storageFailPredict[$i].PredictFailure write-host "Fail Reason:`t" $storageFailPredict[$i].Reason write-host } Write-Host -ForegroundColor Blue -BackgroundColor White "------------ PC Info ------------" "PC Mfr:`t`t" + $w32cs.Manufacturer "PC Model:`t" + $w32cs.Model "PC SN:`t`t" + $w32b.SerialNumber "Memory:`t`t" + "{0:N1}" -f ( [math]::round( $w32cs.TotalPhysicalMemory / 1GB ) ) + " GB" "BIOS Vers.:`t" + $w32b.SMBIOSBIOSVersion write-host Write-Host -ForegroundColor Blue -BackgroundColor White "------------ Monitors ------------" Foreach ( $monitor in $w32mon ){ $mdl = (($monitor.UserFriendlyName | foreach {[char]$_}) -join "").Trim([char]0) $sn = (($monitor.SerialNumberID | foreach {[char]$_}) -join "").Trim([char]0) $mfrName = (($monitor.ManufacturerName | foreach {[char]$_}) -join "").Trim([char]0) if ( $mdl ) { write-host $mfrName $mdl "`tsn`t" $sn } } write-host Write-Host -ForegroundColor Blue -BackgroundColor White "------------ Thermal Info ------------" IF ($therm) { $therm | Format-Table $thermFormat #$therm | Format-Table $thermFormat | out-default } else { Write-Host -ForegroundColor Yellow "Thermal Info not available.`n" } Write-Host -ForegroundColor Black -BackgroundColor White "########################################################"