Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

how to check RAM Size

$
0
0

i want RAM size of all server in domain.

this script help me in getting ram size localy but i want remotly for all server.

i tired foreach but dint sort it for me.

 

 

 

function Get-RAM {param([String[]]$Computers="$($env:COMPUTERNAME)")

 

foreach ($Computer in $Computers) {

$ht = @{}

CLS

 

$PhysicalRAM = (Get-WMIObject -class Win32_PhysicalMemory -ComputerName $Computer |

Measure-Object -Property capacity -Sum | % {[Math]::Round(($_.sum / 1GB),2)})

$ht.Add('Physical RAM GB',$PhysicalRAM)

$OSRAM = gwmi Win32_OperatingSystem -ComputerName $Computer |

foreach {$_.TotalVisibleMemorySize,$_.FreePhysicalMemory}

$ht.Add('Total Visable RAM GB',([Math]::Round(($OSRAM[0] /1MB),4)))

$ht.Add('Total Free RAM GB',([Math]::Round(($OSRAM[1] /1MB),4)))

$RAM = New-Object -TypeName PSObject -Property $ht

Write-Output $RAM | ft -AutoSize

}}

Get-RAM


Viewing all articles
Browse latest Browse all 8583

Latest Images

Trending Articles



Latest Images