Introduction
Powering on or shutting down multiple VMs through the Prism interface can be tedious. With Bash and Nutanix’s acli, you can automate batch VM power operations, whether for scheduled maintenance, environment resets, or DR runbooks. This article shows how to control power states for multiple VMs based on name patterns, tags, or input lists.
My Personal Repository on GitHub
Diagram: VM Power Script Architecture

Sample Input File: vms.txt
web01
web02
db01
db02
Script: Power Off All VMs from List
#!/usr/bin/env bash
set -euo pipefail
input="vms.txt"
log="/var/log/nutanix_power_batch.log"
while IFS= read -r vm; do
echo "[$(date)] Shutting down $vm" | tee -a "$log"
acli vm.off "$vm"
done < "$input"
To Power On Instead
acli vm.on "$vm"
Replace in the loop to power on instead of off.
Optional: Check Power State Before Action
status=$(acli vm.get "$vm" | grep -i "power state" | awk '{print $3}')
if [[ "$status" != "off" ]]; then
acli vm.off "$vm"
fi
Add a Delay Between Actions
For graceful cluster performance:
sleep 10
Insert between commands to stagger actions.
Schedule with Cron
0 20 * * 5 /usr/local/bin/nutanix_power_down.sh
This example powers down VMs every Friday at 8:00 PM.
Summary
Bash and acli make it easy to automate VM power control in AHV clusters. Whether you’re preparing for maintenance or running operational workflows, batch control saves time and reduces human error.
External Documentation:
Introduction Manual VM creation through Prism becomes inefficient at scale. Using acli, Nutanix’s AHV command-line interface, we can script VM deployment workflows...