ESXI Commands

Below commands are useful in listing the VM, registering VM’s & Powering OFF & ON
List all VMs registered to this host (This reveals the Vmid needed for other commands)
vim-cmd /vmsvc/getallvms
Unregister a VM from Inventory.
vim-cmd /vmsvc/unregister <Vmid>
 Register a VM back to inventory.
vim-cmd /solo/register /path/to/file.vmx
(eg)# vim-cmd solo/registervm /vmfs/volumes/datastore_name/VM_directory/VM_name.vmx
 Get power state of a VM
vim-cmd /vmsvc/power.getstate <Vimid>
 Power off a VM
vim-cmd /vmsvc/power.off <Vmid>
 Power on a VM
vim-cmd /vmsvc/power.on <Vmid>
 —————————————————————————————————————————————-

Restarting the Management agents on ESXi

#/etc/init.d/vpxa stop
#/etc/init.d/hostd stop
#/etc/init.d/vpxa start
#/etc/init.d/hostd start
To restart all management agents
services.sh restart
—————————————————————————————————————————————-
Commands to check network Connectivity:
Ping destination-ip
vmkping destination-ip
Command to check connectivity to network port:
Use the below netcat command to check connectivity.
nc -z <destination-ip> <destination-port>
To check connectivity to a range of TCP ports:
nc -w 1 -z <destination-ip> <port range>
SSL Port Connectivity:
openssl s_client -connect destination-ip:ssl-port
Command to check TCP & UDP Connections:
ESX3.5/4.x : netstat -tnp
ESXI4.1       : esxcli network connection list
ESXI5.0 & above: esxcli network ip connection list
———————————————————————————————————————————————–
 If a virtual machine face issues related to NIC, unable to ping & issue in RDP. Please follow the below steps to fix the issue.
NIC Issue in Virtual machine:
SSH to the ESXI host and determine the VMID for the affected virtual machine using the command:
vim-cmd vmsvc/getallvms | grep -i VMNAME
Use the VMID from the command in step 1 to reload the configuration on the host by running the command:
vim-cmd vmsvc/reload VMID
Edit the settings of the virtual machine and connect the NIC.
—————————————————————————————————————————————-
Command to install software & firmware.
esxcli software vib install -d path_to_zip
—————————————————————————————————————————————–

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s