Physical memory check on client systems (Available memory slots and type of memory) using Powershell

Viewed 36

I am trying to find a way to get an inventory of the installed physical memory, on multiple workstations. Someone was gracious enough to post a great script, on this question here...

From a previous question

That works beautifully and it is exactly what I am looking for, however I would like to be able to run this on several workstations (about 150) and running this one at a time is not exactly feasible. The "." being the system, in this case I am using that as the example, my question is where would I be able to insert the Get-Content statement so that it can run against the systems in question.

Here is the script code

[Cmdletbinding()] 
Param( 
    [string]$Computername = "."
) 
cls 

$PhysicalMemory = Get-WmiObject -class "win32_physicalmemory" -namespace "root\CIMV2" -ComputerName $Computername 

Write-Host "Computer Name:" $Computername -ForegroundColor Yellow

Write-Host "Memory Modules:" -ForegroundColor Green 
$PhysicalMemory | Format-Table Tag,BankLabel,@{n="Capacity(GB)";e={$_.Capacity/1GB}},Manufacturer,PartNumber,Speed -AutoSize 
 
Write-Host "Total Memory:" -ForegroundColor Green 
Write-Host "$((($PhysicalMemory).Capacity | Measure-Object -Sum).Sum/1GB)GB" 
 
$TotalSlots = ((Get-WmiObject -Class "win32_PhysicalMemoryArray" -namespace "root\CIMV2" -ComputerName $Computername).MemoryDevices | Measure-Object -Sum).Sum 
Write-Host "`nTotal Memory Slots:" -ForegroundColor Green 
Write-Host $TotalSlots 
 
$UsedSlots = (($PhysicalMemory) | Measure-Object).Count  
Write-Host "`nUsed Memory Slots:" -ForegroundColor Green 
Write-Host $UsedSlots 
 
If($UsedSlots -eq $TotalSlots)
{ 
    Write-Host "All memory slots are in use. No available slots!" -ForegroundColor Yellow 
} 
0 Answers
Related