VIM-CMD : power and register VM

vSphere-O&S

introduction

Welcome to the  first article of VIM-CMD  tool series as part of course  vSphere-O&S 

In first article we will get  an introduction to   tool VIM-CMD , before see how to use it to  manage all vSphere resources  [ Network , Storage ….etc ]

what is VIm-CMD

vim-cmd is a vSphere CLI tool available on every ESXi host and can be used to perform various activities in a VMware environment.

as you  know  that VIM is stand for  (Virtual Infrastructure Management).

where command located on ESXI

On ESXi, the vim-cmd is at /bin/vim-cmd, which is actually a symbolic link to a host executable as shown in the following

For Better View > Open Image in different TAB

get all VM in ESXI

vim-cmd vmsvc/getallvms
For Better View > Open Image in different TAB

Get specific VM status

vim-cmd vmsvc/power.getstate 1 

get power status of VM id =1 which Pc101 in command above 

For Better View > Open Image in different TAB

power-off specific VM

 vim-cmd vmsvc/power.0ff 1
For Better View > Open Image in different TAB

power-on specific VM

 vim-cmd vmsvc/power.on 1

 

 

For Better View > Open Image in different TAB

unregister VM

first we get all registered VMs with command 

vim-cmd vmsvc/getallvms

we will unregister Pc101 with ID 1 

vim-cmd vmsvc/power.getstate 1 

since VM is powered off >> we can unregister it with command 

vim-cmd vmsvc/unregister  1 
For Better View > Open Image in different TAB

register VM

first we get all registered VMs with command 

vim-cmd vmsvc/getallvms

we have 2 VM 

so we will  register Pc101 which will path is [/vmfs/volumes/local-DS02-ESX153/Pc101/Pc101.vmx] 

 

vim-cmd solo/register /vmfs/volumes/local-DS02-ESX153/Pc101/Pc101.vmx 

 

 

For Better View > Open Image in different TAB