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
- 41 Getting started
- 25 Read before posting
- 8 Meet and greet
- 237 General
- 64 News and announcements
- 1 Swag
- 1 Roadmap updates
- 79 Resources
- 12 Knowledge Base
- 16 Webinars
- 1 Shared Script Library
- 2 Blog
- 19 Pro Tips
- 27 Got an idea?
- 3 Atera Academy
- 2 ActionAI
- 1 Copilot
- 140 Remote Monitoring and Management
- 84 Remote Monitoring
- 27 Patch Management
- 105 Professional Services Automation
- 64 Helpdesk
- 17 Billing
- 21 Reporting
- 36 Integrations & add-ons
- 20 Integrations
- 10 Add-ons
- 103 Scripting and automations
- 61 Scripts
- 30 Automations