Helpful Scripts
I made a script to help you understand more about a device's RAM than Atera's agent will show you. We use this to easily see the RAM size and speed and how many RAM slots are available/used. It's very nice for upsell purposes. It gives you some recommendations at the bottom of the output. Save this in your script library as a Powershell script.
Convert FormFactor to readable formatfunction Get-FormFactor {
param (
[int]$factor
)
switch ($factor) {
8 { return "DIMM" }
12 { return "SODIMM" }
default { return "Unknown" }
}
}
$memoryDetails = Get-WmiObject -Class "Win32_PhysicalMemory" | Select-Object BankLabel,
@ .Capacity / 1GB, 2)}}, DeviceLocator,
@{Name="Speed (MHz)";Expression={$.Speed}}, Manufacturer,
PartNumber, `
@{Name="FormFactor";Expression={Get-FormFactor $_.FormFactor}}
$totalSlots = (Get-WmiObject -Class "Win32_PhysicalMemoryArray").MemoryDevices
$usedSlots = $memoryDetails.Count
$availableSlots = $totalSlots - $usedSlots
$memoryStatus = Get-WmiObject -Class "Win32_OperatingSystem"
$totalVisibleMemory = [math]::round($memoryStatus.TotalVisibleMemorySize / 1MB, 2)
$freePhysicalMemory = [math]::round($memoryStatus.FreePhysicalMemory / 1MB, 2)
$usedPhysicalMemory = $totalVisibleMemory - $freePhysicalMemory
$usedMemoryPercentage = [math]::round(($usedPhysicalMemory / $totalVisibleMemory) * 100, 2)
Write-Output "Memory Module Details:"
$memoryDetails | Format-Table -AutoSize
Write-Output "nTotal Number of DIMM Slots Available: $totalSlots"
nCurrent Memory Usage:"
Write-Output "Number of DIMM Slots Currently in Use: $usedSlots"
Write-Output "Number of DIMM Slots Available for Use: $availableSlots"
Write-Output "
Write-Output "Total Visible Memory: $totalVisibleMemory GB"
Write-Output "Used Physical Memory: $usedPhysicalMemory GB"
Write-Output "Free Physical Memory: $freePhysicalMemory GB"
Write-Output "Memory Usage: $usedMemoryPercentage%"
Write-Output "`n"
$recommendations = @()
if ($totalVisibleMemory -le 8) {
$recommendations += "Consider upgrading to at least 16 GB of RAM for better performance."
} elseif ($usedMemoryPercentage -ge 70) {
if ($totalVisibleMemory -lt 16) {
$recommendations += "Consider upgrading to at least 16 GB of RAM for better performance."
} else {
$recommendations += "Current RAM is sufficient for most tasks."
}
}
if ($recommendations.Count -eq 0) {
$recommendations += "No immediate upgrades are necessary."
}
Write-Output "Recommendations:"
$recommendations | ForEach-Object { Write-Output $_ }
Comments
-
For some devices, it doesn't pull all the info, and for some, it does, but it still gets the job done for knowing how much RAM there is, what the speed is, and how many slots are used/available.
0 -
Very nice! Thank you for generously sharing @tanderson. Much appreciated.
1 -
That's wonderful! Go @tanderson! 👏👏👏👏
0
Topics
- All Topics
- 42 Getting started
- 26 Read before posting
- 8 Meet and greet
- 257 General
- 71 News and announcements
- 2 Swag
- 1 Roadmap updates
- 83 Resources
- 12 Knowledge Base
- 17 Webinars
- 1 Shared Script Library
- 2 Blog
- 21 Pro Tips
- 28 Got an idea?
- 3 Atera Academy
- 2 ActionAI
- 1 Copilot
- 142 Remote Monitoring and Management
- 85 Remote Monitoring
- 28 Patch Management
- 107 Professional Services Automation
- 65 Helpdesk
- 17 Billing
- 22 Reporting
- 41 Integrations & add-ons
- 22 Integrations
- 11 Add-ons
- 108 Scripting and automations
- 62 Scripts
- 32 Automations