Monday, December 30, 2013

Physical Memory Capacity using Powershell and WMI

A small Script to fetch Physical Memory installed/mounted on the host as below. It gives you the Slots,DIMM number and capacity of the RAM in GB for the Remote Hosts using WMI. Copy the below contents [ In Green] to the notepad and save it as .ps1 file with name of your choice.
How to Run:
  • Run PowerShell from start—>Run—>Type PowerShell and hit Enter
  • Go the location where the script file is saved. CD “location path”
  • type .\filename.ps1 “Hostname”
Ex: .\filename.ps1 shashank where, .\filename.ps1 is script and shashank is the host for which you want to compute the Physical Memory Availability.
#Author:Shashanka Haritsa @ February 2011
#Script will fetch DIMMS and their Physical Memory Capacity
$count = 0
$memories = get-wmiobject win32_physicalmemory -computername $args
“=====================================================”
foreach ($Dimm in $memories){
$Dimm.BankLabel + ” ” + $Dimm.DeviceLocator +” Capacity = ” + $Dimm.Capacity/(1024*1024*1024) + “GB”
$Count = $Count + 1
}
“=====================================================”
“Found Totally ” + $Count + ” Installed Memory Modules”
“=====================================================”
I hope this helps to gather the information required from Remote hosts in Faster way.

No comments:

Post a Comment