PowerShell Script to List RAM Slots

I modified a script that I found online to give a detailed view of RAM slots in the system.

Script:

$computer = Read-Host "Enter computer name: "
$arrays = gwmi -Class "Win32_PhysicalMemoryArray" -computerName $computer
$ram = gwmi -Class "Win32_PhysicalMemory" -computerName $computer
$total = 0

#Create customized headers and formula for slot info table
$headers = @{Expression = {$_.DeviceLocator}; Label = "Slot"},`
@{Expression = {$_.Capacity / 1GB}; Label = "Size (GB)"}

#Display total slots per memory array
$arrays | foreach{
"Total number of slots: " + $_.MemoryDevices
}

#Display slot information
 $ram | format-table $headers

#Calculate total ram
 $ram | foreach{ $total += ($_.Capacity / 1GB) }

#Display total ram
 "Total memory installed: " + $total + " GB"

The original code may be found at: PowerShell Pro!

About these ads

One thought on “PowerShell Script to List RAM Slots

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s