Skip to content

Instantly share code, notes, and snippets.

@antdimot
Created March 27, 2019 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antdimot/650702256ad7370b344970ec00f0bd77 to your computer and use it in GitHub Desktop.
Save antdimot/650702256ad7370b344970ec00f0bd77 to your computer and use it in GitHub Desktop.
Check CPU, Memory and OS info
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