Created
September 17, 2023 19:05
-
-
Save rma92/7896eb97c3d29ac81e31b5fb60d78bc6 to your computer and use it in GitHub Desktop.
Get total RAM memory usage of Bloomberg Terminal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define the process names | |
$processNames = @("wintrv", "bplus.wtk2", "bplus64") | |
# Initialize a variable to store the total memory usage | |
$totalMemoryUsageBytes = 0 | |
# Loop through each process name | |
foreach ($name in $processNames) { | |
# Get the processes with the current name | |
$processes = Get-Process | Where-Object { $_.ProcessName -eq $name } | |
# Calculate and add up the memory usage of each process with the current name | |
$totalMemoryUsageBytes += $processes | Measure-Object -Property WorkingSet -Sum | Select-Object -ExpandProperty Sum | |
} | |
# Convert total memory usage to megabytes (MB) with digit grouping | |
$totalMemoryUsageMB = [math]::Round($totalMemoryUsageBytes / 1MB, 2) | |
$totalMemoryUsageFormatted = $totalMemoryUsageMB.ToString("N0") | |
# Display the total memory usage in MB with digit grouping | |
Write-Host "Total Memory Usage for $($processNames -join ', '): $totalMemoryUsageFormatted MB" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment