Here's an example of a PowerShell script that accomplishes this task:
# Specify the device names
$devices = "Device1", "Device2", "Device3"
foreach ($device in $devices) {
Write-Host "Device: $device"
# Get the top 5 memory-consuming processes
$memoryProcesses = Get-Process -ComputerName $device | Sort-Object -Property WS -Descending | Select-Object -First 5
Write-Host "`nTop 5 Memory Consuming Processes:"
$memoryProcesses | Format-Table Name, WS -AutoSize
# Get the top 5 CPU-consuming processes
$cpuProcesses = Get-Process -ComputerName $device | Sort-Object -Property CPU -Descending | Select-Object -First 5
Write-Host "`nTop 5 CPU Consuming Processes:"
$cpuProcesses | Format-Table Name, CPU -AutoSize
Write-Host "--------------------------------------------------`n"
}
Here's how you can use this script:
Open a text editor and copy the script into a new file with a .ps1 extension (e.g., dashboard.ps1). Modify the $devices variable to contain the names or IP addresses of your three devices (e.g., "Device1", "Device2", "Device3"). Save the file. Open PowerShell and navigate to the directory where you saved the script. Run the script by entering its name (e.g., .\dashboard.ps1) and press Enter. The script will iterate over each device, retrieve the top 5 memory-consuming and CPU-consuming processes, and display the results in separate panes for each device.