Here is a PowerShell script to list the virtual machines (VMs) on an ESXi host:
#Connect to the ESXi hostConnect-VIServer -Server <ESXi_host_name># Get a list of all VMs on the ESXi host$VMs = Get-VM# Loop through each VM and display its name and power stateforeach ($VM in $VMs){Write-Host "Name: $($VM.Name), Power State: $($VM.PowerState)"}# Disconnect from the ESXi hostDisconnect-VIServer -Server <ESXi_host_name> -Confirm:$falseNote: Replace<ESXi_host_name>with the actual hostname of the ESXi host

Leave a comment