vim-cmd vmsvc/getallvms

vim-cmd vmsvc/power.getstate <vmid>

vim-cmd vmsvc/power.shutdown <vmid>

vim-cmd vmsvc/power.off  <vmid>

vim-cmd vmsvc/power.on <vmid>



Error:

"The virtual machine inventory file is damaged or unreadable..."

For ESXi 3.5, 4.x, 5.x, 6.x

Log in to the VMware ESX/ESXi host as the root user. For more information on VMware ESXi 4.1 and ESXi 5.x Technical Support Mode, see Using Tech Support Mode in ESXi 4.1 and ESXi 5.x (1017910)

To list all running virtual machines and their corresponding VMIDs, run these commands:

vim-cmd vmsvc/getallvms

cd /etc/vmware/hostd/


Make a copy of vmInventory.xml file by running this command:

cp vmInventory.xml vmInventory.xml.bak

 

Stop the vpxa and hostd services by running these commands:

/etc/init.d/vpxa stop

/etc/init.d/hostd stop

 

Rename the vmInventory.xml file by running this command:

Note: This action unregisters all virtual machines from the host.

mv vmInventory.xml vmInventory_xml.bak

 

Start the vpxa and hostd services by running these commands:

/etc/init.d/vpxa start

/etc/init.d/hostd start

 

Log in to vSphere Client and verify that the virtual machine Inventory is now displayed as blank.

Use this command to register every virtual machine back to Inventory on the host:


vim-cmd solo/registervmfull_path_of_VMX


For Example: vim-cmd solo/registervm /vmfs/volumes/datastore_name/VM_directory/VM_name.vmx

 

https://kb.vmware.com/s/article/1031605