-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGet-RAMInfo.ps1
More file actions
18 lines (14 loc) · 765 Bytes
/
Copy pathGet-RAMInfo.ps1
File metadata and controls
18 lines (14 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Get-RAMInfo.ps1
# Retrieves total physical memory capacity from a remote or local computer
# --- Configuration ---
$ComputerName = "<PCName>" # e.g., "DESKTOP-001" or "." for local
# ---------------------
Write-Host "--- Physical Memory on $ComputerName ---" -ForegroundColor Cyan
# With credentials (for remote):
# $Credential = Get-Credential -Message "Enter credentials (domain\user)"
# Get-WmiObject Win32_PhysicalMemory -Credential $Credential -ComputerName $ComputerName |
# Measure-Object -Property Capacity -Sum
# Local:
$MemResult = Get-WmiObject Win32_PhysicalMemory | Measure-Object -Property Capacity -Sum
$TotalGB = [math]::Round($MemResult.Sum / 1GB, 2)
Write-Host "Total RAM: $TotalGB GB ($($MemResult.Sum) bytes)" -ForegroundColor Green