메모리 슬롯 및 메모리 전체 용량 체크 powershell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
[Cmdletbinding()] Param( [string]$Computername = "localhost" ) cls $PysicalMemory = Get-WmiObject -class "win32_physicalmemory" -namespace "root\CIMV2" -ComputerName $Computername Write-Host "Memore Modules:" -ForegroundColor Green $PysicalMemory | Format-Table Tag,BankLabel,@{n="Capacity(GB)";e={$_.Capacity/1GB}},Manufacturer,PartNumber,Speed -AutoSize Write-Host "Total Memory:" -ForegroundColor Green Write-Host "$((($PysicalMemory).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 = (($PysicalMemory) | Measure-Object).Count Write-Host "`nUsed Memory Slots:" -ForegroundColor Green Write-Host $UsedSlots If($UsedSlots -eq $TotalSlots) { Write-Host "All memory slots are filled up, none is empty!" -ForegroundColor Yellow } |