One Liner Command to Get List of VM on ESX Host

Today, I would like to share how to get a list of virtual machine (VM) on a ESX host using one liner command. Make sure you are logged on to an ESX host. Below is the one liner command to get a list of VM on a ESX host: –

for i in $(vmware-cmd -l); do echo "`grep displayName $i | awk '{print $3}' | sed -e 's/"//g'`" "Powered" "`vmware-cmd $i getstate | awk '{print $3}'`" ; done

I will be sharing more useful commands. Stay tune. Thank you and have fun.