← script library

Efficient System Health Checks with PowerShell

Monitoring & HealthDecember 23, 2024

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.

Ready when you are.

Try ServerEngine free for 7 days.