The 8:00 AM Sysadmin Nightmare
It’s 8:00 AM. You just stepped into the office, coffee still steaming, and your eyes are already glued to the monitor. The first routine of the day: open the browser, log into vCenter, and kick off the tedious, all-too-familiar clicking marathon.
You click through every cluster to see which ESXi host is flashing yellow or red. You check every datastore to see if any disk usage has hit the 90% threshold. But the biggest landmine is snapshots. If a developer creates a snapshot to test a patch on Friday afternoon and completely forgets about it, that delta file can easily swell to 200–300 GB by Monday, chewing up the entire LUN and freezing neighboring VMs solid right in the middle of peak hours.
Picture this: it’s like a warehouse guard having to walk through 50 rooms every morning, manually unlocking every door and inspecting every single crate just to jot down notes in a logbook. It’s exhausting, time-consuming, and notoriously prone to human error.
Manual Web UI Checks: An Unsustainable Task at Scale
The vSphere Client is wonderfully intuitive if you’re only managing two or three lab servers. But once your infrastructure scales to 15 ESXi hosts and over 300 virtual machines, the GUI quickly becomes a major bottleneck:
- Cluttered and error-prone: With hundreds of graphs, alerts, and dynamic metric tables constantly updating, it’s remarkably easy to overlook a critically full partition amid dozens of open tabs.
- Time-consuming: Switching tabs or reloading pages takes anywhere from several seconds to a full minute. On average, you waste 30 to 45 minutes every morning just clicking around.
- Inconsistent: On Monday morning, you might inspect every detail meticulously. Come Friday when deadlines loom, you rush through a few screens and skip snapshot verification entirely. Systems almost always crash on the days vigilance slips.
The Solution: Offload the Busywork to VMware PowerCLI
To break free from this cycle, you could set up Zabbix, configure PRTG, or write custom scripts against REST APIs. However, the most lightweight, free, and industry-standard tool for VMware administrators remains VMware PowerCLI.
PowerCLI bundles hundreds of purpose-built cmdlets built on PowerShell. Its greatest strength is an intuitive, easy-to-remember Verb-Noun syntax—such as Get-VM, Get-Datastore, or Restart-VMHost. Instead of navigating 50 web menus, a single command retrieves all the information you need in seconds.
Step 1: Install VMware PowerCLI
PowerCLI runs smoothly on both PowerShell 5.1 and PowerShell 7 (supporting Windows, macOS, and Linux). Launch PowerShell as Administrator and run the following two commands:
# Install the VMware.PowerCLI module from the PowerShell Gallery
Install-Module -Name VMware.PowerCLI -Scope CurrentUser -Repository PSGallery -Force
# Ignore SSL certificate warnings if vCenter uses a self-signed certificate
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false
Downloading the module packages typically takes 1 to 3 minutes, depending on your internet connection.
Step 2: Connect to vCenter Server
Establish a connection to vCenter Server using an account with read-only permissions (read-only access is sufficient for health checks):
Connect-VIServer -Server 192.168.1.50 -User [email protected] -Password "YourPassword123!"
Once the prompt displays the vCenter server name and build version, you have connected successfully.
Step 3: Write a Health Check Script for the Top 3 Core Risks
A morning health check script only needs to focus on three critical hotspots: powered-off VMs, snapshots older than 3 days, and datastores with less than 15% free disk space.
# 1. Check for powered-off virtual machines (PoweredOff)
Write-Host "=== LIST OF POWERED-OFF VMS ===" -ForegroundColor Yellow
Get-VM | Where-Object { $_.PowerState -eq "PoweredOff" } | Select-Object Name, NumCpu, MemoryGB
# 2. Scan for stale snapshots older than 3 days
Write-Host "`n=== WARNING: SNAPSHOTS OLDER THAN 3 DAYS ===" -ForegroundColor Red
Get-VM | Get-Snapshot | Where-Object { $_.Created -lt (Get-Date).AddDays(-3) } | Select-Object @{N="VM";E={$_.VM.Name}}, Name, Created, @{N="SizeGB";E={[math]::Round($_.SizeGB, 2)}}
# 3. Alert on datastores with less than 15% free space
Write-Host "`n=== WARNING: DATASTORE NEARLY FULL (< 15% FREE) ===" -ForegroundColor Cyan
Get-Datastore | ForEach-Object {
$percentFree = [math]::Round(($_.FreeSpaceGB / $_.CapacityGB) * 100, 2)
if ($percentFree -lt 15) {
[PSCustomObject]@{
DatastoreName = $_.Name
CapacityGB = [math]::Round($_.CapacityGB, 2)
FreeSpaceGB = [math]::Round($_.FreeSpaceGB, 2)
PercentFree = "$percentFree %"
}
}
}
Step 4: Automate Execution for 7:30 AM
You don’t need to open a terminal and run commands by hand every day. Save the script above as DailyHealthCheck.ps1, then schedule it to run automatically:
- On Windows: Open Task Scheduler and create a daily task triggered at 7:30 AM to run in the background and export the report to an HTML file or email alert.
- On Linux/Docker: Add a crontab entry invoking PowerShell Core (
pwsh).
# Configure Action in Windows Task Scheduler:
# Program/script: pwsh.exe (or powershell.exe)
# Add arguments: -ExecutionPolicy Bypass -File "C:\Scripts\DailyHealthCheck.ps1"
From now on, by the time you step into the office each morning, your infrastructure health report will already be waiting in your inbox or log file. If there are issues, you can address them immediately; if everything is green, enjoy your morning coffee in peace—without lifting a finger to click through the UI.
