Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
vmware:tip:cli [2016/04/26 13:12] jsvmware:tip:cli [2021/02/12 14:54] (current) js
Line 1: Line 1:
-====== command lines on esxi ======+===== command lines on esxi =====
  
-  * Register a VM +=== Register a VM ===
 <code bash>vim-cmd solo/registervm path_to_vmx_file</code> <code bash>vim-cmd solo/registervm path_to_vmx_file</code>
- +=== Unregister a VM === 
-  * Unregister a VM+
 <code bash>vim-cmd vmsvc/unregister vmid</code> <code bash>vim-cmd vmsvc/unregister vmid</code>
- +=== Delete a VM === 
-  * Delete a VM+
 <code bash>vim-cmd vmsvc/destroy vmid</code> <code bash>vim-cmd vmsvc/destroy vmid</code>
 +=== Get a listing of VMs on a host === 
 +<code bash>esxcli vm process list</code><code bash>vim-cmd vmsvc/getallvms</code>
 +=== Determine if a VM has a snapshot === 
 +<code bash>vim-cmd vmsvc/get.snapshot vmid</code>
 +=== Take a snapshot of a VM === 
 +<code bash>vim-cmd vmsvc/snapshot.create vmid snapshot_name</code>
 +=== Remove a snapshot of a VM === 
 +<code bash>vim-cmd vmsvc/snapshot.remove vmid</code>
 +=== Get the current power state of a VM === 
 +<code bash>vim-cmd vmsvc/power.getstate vmid</code>
 +=== Get the uptime for a VM === 
 +<code bash>vim-cmd vmsvc/get.summary vmid |grep uptimeSeconds</code>
 +=== Power on a VM === 
 +<code bash>vim-cmd vmsvc/power.on vmid</code>
 +=== Shutdown a VM === 
 +<code bash>vim-cmd vmsvc/power.shutdown vmid</code>
 +=== Shutdown a VM ===
 +<code bash>vim-cmd vmsvc/power.shutdown vmid</code>
 +=== Power off a VM === 
 +<code bash>esxcli vm process kill –w world_id</code>
 +<code bash>vim-cmd vmsvc/power.off vmid</code>
 +=== Reboot a VM === 
 +<code bash>vim-cmd vmsvc/power.reboot vmid</code>
 +=== Reset a VM === 
 +<code bash>vim-cmd vmsvc/power.reset vmid</code>
 +=== Upgrade VMware Tools in a VM === 
 +<code bash>vim-cmd vmsvc/tools.upgrade vmid</code>
 +=== Display the IP address of a VM === 
 +<code bash>vim-cmd vmsvc/get.guest vmid |grep -m 1 "ipAddress = \""</code>
  
-Get a listing of VMs on a host esxcli vm process list   +=== Display all info for all vmnics === 
-vim-cmd vmsvc/getallvms +<code bash>for i in $(esxcfg-nics -l | awk '{print $1}' | tail -n +2); do esxcli network nic get -n $i; done</code>
- +
-Determine if a VM has a snapshot vim-cmd vmsvc/get.snapshot vmid +
- +
-Take a snapshot of a VM vim-cmd vmsvc/snapshot.create vmid snapshot_name +
- +
-Remove a snapshot of a VM vim-cmd vmsvc/snapshot.remove vmid +
- +
-Get the current power state of a VM vim-cmd vmsvc/power.getstate vmid +
- +
-Get the uptime for a VM vim-cmd vmsvc/get.summary vmid |grep uptimeSeconds +
- +
-Power on a VM vim-cmd vmsvc/power.on vmid +
- +
-Shutdown a VM vim-cmd vmsvc/power.shutdown vmid+
  
-Power off a VM esxcli vm process kill –w world_id +=== Show syslog host === 
-vim-cmd vmsvc/power.off vmid+<code bash>vim-cmd hostsvc/advopt/view Syslog.Remote.Hostname | grep -i "value =" | awk -F'"' '{print $2}'</code> 
 +=== Show syslog target port === 
 +<code bash>vim-cmd hostsvc/advopt/view Syslog.Remote.Port | grep "value =" | sed -e 's/^.*value = \([^ ,]*\).*$/\1/'</code>
  
-Reboot a VM vim-cmd vmsvc/power.reboot vmid+=== Show scratch location === 
 +<code bash>vim-cmd hostsvc/advopt/view Syslog.Local.DatastorePath | grep -i "value =" | awk -F'"' '{print $2}'</code>
  
-Reset a VM vim-cmd vmsvc/power.reset vmid+=== Get task list of VM === 
 +<code bash>vim-cmd vmsvc/get.tasklist <VMID></code>
  
-Upgrade VMware Tools in VM vim-cmd vmsvc/tools.upgrade vmid+=== Get info for specified task === 
 +<code bash>vim-cmd vimsvc/task_info <TaskNr></code> See the number in the "vim.Task ..." line
  
-Display the IP address of a VM vim-cmd vmsvc/get.guest vmid |grep -m 1 "ipAddress = \""+=== Get memory information === 
 +<code bash>vsish -get /memory/comprehensive</code> 
 +<code>Comprehensive { 
 +   Physical memory estimate:12454784 KB 
 +   Given to VMKernel:12454784 KB 
 +   Reliable memory:0 KB 
 +   Discarded by VMKernel:1580 KB 
 +   Mmap critical space:0 KB 
 +   Mmap buddy overhead:3084 KB 
 +   Kernel code region:18432 KB 
 +   Kernel data and heap:14336 KB 
 +   Other kernel:1421360 KB 
 +   Non-kernel:120036 KB 
 +   Reserved memory at low addresses:59900 KB 
 +   Free:10875956 KB 
 +}</code>