Automation · VMware Automation
VMware Automation Troubleshooting
Cheat sheet · https://pcornel.dk/topic.php?topic=5741
Answer
Troubleshoot VMware automation by checking the vCenter session and permissions, task and event logs in vCenter, PowerCLI version and InvalidCertificateAction settings, and object name ambiguity.
Remember
- Session and permissions cause many failures.
- vCenter tasks show errors.
- Ambiguous names select wrong objects.
First checks
$Error[0] | fl * -Force— PowerCLI errorGet-Task | ? State -eq Error | select -Last 5— failed tasksGet-VIEvent -Start (Get-Date).AddHours(-1) -Types Error— events
Commands
Get-VMHost | Select-Object Name,ConnectionState,PowerState- Read-only/validation observation for ESXi host identity, vCenter connection state and power state.
Verify in this order
script → vCenter → task → error
Where it usually breaks
Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5741