mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-22 21:58:42 +01:00
Add check-ram.ps1
This commit is contained in:
parent
3f9ee0d023
commit
c15f94928b
@ -13,10 +13,11 @@
|
||||
|
||||
& "$PSScriptRoot/check-uptime.ps1"
|
||||
& "$PSScriptRoot/check-operating-system.ps1"
|
||||
& "$PSScriptRoot/check-time-zone.ps1"
|
||||
& "$PSScriptRoot/check-swap-space.ps1"
|
||||
& "$PSScriptRoot/check-drives.ps1"
|
||||
& "$PSScriptRoot/check-cpu.ps1"
|
||||
& "$PSScriptRoot/check-ram.ps1"
|
||||
& "$PSScriptRoot/check-swap-space.ps1"
|
||||
& "$PSScriptRoot/check-time-zone.ps1"
|
||||
& "$PSScriptRoot/check-drives.ps1"
|
||||
& "$PSScriptRoot/check-dns.ps1"
|
||||
& "$PSScriptRoot/check-ping.ps1"
|
||||
& "$PSScriptRoot/check-vpn.ps1"
|
||||
|
54
Scripts/check-ram.ps1
Normal file
54
Scripts/check-ram.ps1
Normal file
@ -0,0 +1,54 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks the RAM
|
||||
.DESCRIPTION
|
||||
This PowerShell script queries and prints details of the installed RAM.
|
||||
.EXAMPLE
|
||||
PS> ./check-ram
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
function GetRAMType { param([int]$Type)
|
||||
switch($Type) {
|
||||
2 { return "DRAM" }
|
||||
5 { return "EDO RAM" }
|
||||
6 { return "EDRAM" }
|
||||
7 { return "VRAM" }
|
||||
8 { return "SRAM" }
|
||||
10 { return "ROM" }
|
||||
11 { return "Flash RAM" }
|
||||
12 { return "EEPROM" }
|
||||
13 { return "FEPROM" }
|
||||
14 { return "EPROM" }
|
||||
15 { return "CDRAM" }
|
||||
16 { return "3DRAM" }
|
||||
17 { return "SDRAM" }
|
||||
18 { return "SGRAM" }
|
||||
19 { return "RDRAM" }
|
||||
20 { return "DDR RAM" }
|
||||
21 { return "DDR2 RAM" }
|
||||
22 { return "DDR2 FB-DIMM" }
|
||||
26 { return "DDR4 RAM" }
|
||||
default { return "RAM" }
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$Banks = Get-WmiObject -Class Win32_PhysicalMemory
|
||||
foreach ($Bank in $Banks) {
|
||||
$Capacity = $Bank.Capacity / (1024 * 1024 * 1024)
|
||||
$Type = GetRAMType $Bank.SMBIOSMemoryType
|
||||
$Speed = $Bank.Speed
|
||||
[float]$Voltage = $Bank.ConfiguredVoltage / 1000.0
|
||||
$Vendor = $Bank.Manufacturer
|
||||
$BankName = $Bank.DeviceLocator
|
||||
"✅ $($Capacity)GB $Type ($($Speed)MHz, $($Voltage)V, $Vendor) in bank $BankName."
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
Loading…
Reference in New Issue
Block a user