Created
March 27, 2019 17:00
-
-
Save antdimot/650702256ad7370b344970ec00f0bd77 to your computer and use it in GitHub Desktop.
Check CPU, Memory and OS info
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
if($args.Count -eq 1) | |
{ | |
$pcname = $args[0] | |
$meminfo = Get-WmiObject CIM_PhysicalMemory -ComputerName $pcname | Measure-Object -Property capacity -sum | % {[math]::round(($_.sum / 1GB),2)} | |
$CPUInfo = (Get-WmiObject Win32_Processor -ComputerName $pcname).Name | |
$OSInfo = (Get-WmiObject Win32_OperatingSystem -ComputerName $pcname).Version | |
Write-Output "CPU -> ""$CPUInfo""" | |
Write-Output "Memory -> ""$meminfo""" | |
Write-Output "OS -> ""$OSInfo""" | |
} else { | |
Write-Output "$args" | |
Write-Output "Bad Parameters!!! I need one parameter:" | |
Write-Output " 1: machine name (or ip address)" | |
Write-Output "Example: .\GetPcInfo.ps1 ""127.0.0.1""" | |
exit 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment