⚡ PowerShell 5.1+

Get Physical Memory Modules Report

Queries Win32_PhysicalMemory via WMI and reports Physical Memory Modules in a formatted table, with an optional CSV export.

By WindowsScripting.com · 966 B
Get-PhysicalMemoryReport.ps1
<#
.SYNOPSIS
    Reports Physical Memory Modules on this computer via WMI (Win32_PhysicalMemory).

.DESCRIPTION
    Queries Win32_PhysicalMemory and displays BankLabel, Capacity, Speed, Manufacturer for each item found.
    Use -ExportPath to also save the results to a CSV file.

.PARAMETER ExportPath
    Optional path to a .csv file to write the results to.

.EXAMPLE
    .\Get-PhysicalMemoryReport.ps1

.EXAMPLE
    .\Get-PhysicalMemoryReport.ps1 -ExportPath C:\Reports\physicalmemory.csv
#>

[CmdletBinding()]
param(
    [string]$ExportPath
)

$items = Get-CimInstance -ClassName Win32_PhysicalMemory | Select-Object BankLabel, Capacity, Speed, Manufacturer

if (-not $items) {
    Write-Host "No Physical Memory Modules found." -ForegroundColor Yellow
    return
}

$items | Format-Table -AutoSize

if ($ExportPath) {
    $items | Export-Csv -Path $ExportPath -NoTypeInformation -Encoding UTF8
    Write-Host "`nExported to $ExportPath" -ForegroundColor Cyan
}