Welcome to our dedicated section for sharing valuable PowerShell scripts that can improve your operational efficiency. System Health Checks are essential for ensuring your IT infrastructure runs smoothly. This script focuses on performing health checks for Hyper-V hosts, allowing you to quickly identify any issues or performance bottlenecks in your virtualization environment. Here is a sample PowerShell script for conducting system health checks on Hyper-V:
powershell
# Ensure Hyper-V module is imported
Import-Module Hyper-V
# Get the list of all Hyper-V VMs
$vms = Get-VM
# Check the status of each VM
foreach ($vm in $vms) {
$status = $vm.State
$cpuUsage = Get-VMProcessor -VM $vm.Name | Select-Object -ExpandProperty AverageLoad
$memoryAssigned = Get-VMMemory -VM $vm.Name | Select-Object -ExpandProperty MemoryStartup
Write-Host "VM Name: $($vm.Name), Status: $status, CPU Usage: $cpuUsage%, Memory Assigned: $memoryAssigned MB"
}
Write-Host "System health check completed for all Hyper-V virtual machines."Run it across your fleet
This script runs as-is on a single host. Paste it into ServerEngine to schedule it, run it on a whole server group in parallel, and keep the credentials out of the file — see the scripts documentation and the credential store.
More in Monitoring & Health
Disk Space Cleanup and Report Script
2025-01-14User Account Status Reporting Script
2025-01-13Automated Disk Space Monitoring Script
2025-01-13Monitor System Performance with PowerShell
2025-01-12Automating System Health Check with PowerShell
2025-01-05Automate System Performance Monitoring with PowerShell
2024-12-30Ready when you are.
Try ServerEngine free for 7 days.