Tag Archives: esxi

ESXi loop through all VMs ID from cli

for i in $(vim-cmd vmsvc/getallvm | awk -F' ' '/[0-9]/{print $1}'); do vim-cmd vmsvc/get.summary $i | grep name; vim-cmd vmsvc/power.getstate $i; done

The magic part is:
vim-cmd vmsvc/getallvm | awk -F' ' '/[0-9]/{print $1}'