VmWare/Misc Commands

From r00tedvw.com wiki
(Difference between revisions)
Jump to: navigation, search
 
(2 intermediate revisions by one user not shown)
Line 3: Line 3:
 
(to be used with SSH--see below for enabling SSH)
 
(to be used with SSH--see below for enabling SSH)
  
List VMs (get vmIds):
+
=====List VMs (get vmIds)=====
 
  vim-cmd vmsvc/getallvms
 
  vim-cmd vmsvc/getallvms
  
 
+
=====VM status=====
VM status:
+
 
  vim-cmd vmsvc/power.getstate vmId
 
  vim-cmd vmsvc/power.getstate vmId
  
 
+
=====Power on/off a VM=====
Power on/off a VM:
+
 
  vim-cmd vmsvc/power.[on/off] vmId
 
  vim-cmd vmsvc/power.[on/off] vmId
  
 
+
=====Get the IP address of a VM=====
Get the IP address of a VM:
+
 
  vim-cmd vmsvc/get.summary vmId | grep ipAddress
 
  vim-cmd vmsvc/get.summary vmId | grep ipAddress
  
 
+
=====To list available commands=====
To list available commands:
+
 
  vim-cmd help
 
  vim-cmd help
 
  vim-cmd vmsvc
 
  vim-cmd vmsvc
  
 
+
=====Standard VM operations=====
Standard VM operations:
+
 
  vim-cmd vmsvc/power.getstate vmId
 
  vim-cmd vmsvc/power.getstate vmId
 
  vim-cmd vmsvc/power.on vmId
 
  vim-cmd vmsvc/power.on vmId
Line 43: Line 38:
 
  vim-cmd vmsvc/snapshot.get vmId
 
  vim-cmd vmsvc/snapshot.get vmId
  
 
+
=====Remove a VM=====
Remove a VM:
+
 
  vim-cmd vmsvc/unregister vmId
 
  vim-cmd vmsvc/unregister vmId
 
  then delete the vm directory from the datastore (/vmfs/...)
 
  then delete the vm directory from the datastore (/vmfs/...)
  
 
+
=====Maintenance mode for ESX host=====
Maintenance mode for ESX host:
+
 
**(unfortunately this command will not evacuate/VMotion your VMs to rest of the cluster)
 
**(unfortunately this command will not evacuate/VMotion your VMs to rest of the cluster)
 
  vim-cmd hostsvc/maintenance_mode_enter
 
  vim-cmd hostsvc/maintenance_mode_enter
 
  vim-cmd hostsvc/maintenance_mode_exit
 
  vim-cmd hostsvc/maintenance_mode_exit
  
 
+
=====show the DCUI (direct console user interface)=====
show the DCUI (direct console user interface)
+
 
  dcui
 
  dcui
  
 
Ctrl-C to exit
 
Ctrl-C to exit
  
 
+
=====Enable SSH (from terminal)=====
Enable SSH (from terminal):
+
  vi /var/run/inetd.conf
  vi /etc/inetd.conf
+
 
  uncomment ssh line (remove # from line that starts with #ssh)
 
  uncomment ssh line (remove # from line that starts with #ssh)
 
  save the file (:wq)
 
  save the file (:wq)
Line 68: Line 59:
 
  kill -HUP `ps | grep inetd`
 
  kill -HUP `ps | grep inetd`
  
Remove/Add SSH enabled warnings
+
=====Remove/Add SSH enabled warnings=====
 
To disable these warnings using esxcli:
 
To disable these warnings using esxcli:
 
  esxcli system settings advanced set -o /UserVars/SuppressShellWarning -i 1  
 
  esxcli system settings advanced set -o /UserVars/SuppressShellWarning -i 1  
 
To enable these warnings using esxcli:
 
To enable these warnings using esxcli:
 
  esxcli system settings advanced set -o /UserVars/SuppressShellWarning -i 0
 
  esxcli system settings advanced set -o /UserVars/SuppressShellWarning -i 0
 +
 +
=====Change hostname=====
 +
<nowiki>~$ esxcli system hostname set --host=hostname
 +
~$esxcli system hostname set --fqdn=fqdn.com</nowiki>

Latest revision as of 21:23, 2 January 2017

(https://sites.google.com/site/bmaupinwiki/home/applications/vmware/vmware-esxi)
Misc commands (to be used with SSH--see below for enabling SSH)

Contents

[edit] List VMs (get vmIds)
vim-cmd vmsvc/getallvms
[edit] VM status
vim-cmd vmsvc/power.getstate vmId
[edit] Power on/off a VM
vim-cmd vmsvc/power.[on/off] vmId
[edit] Get the IP address of a VM
vim-cmd vmsvc/get.summary vmId | grep ipAddress
[edit] To list available commands
vim-cmd help
vim-cmd vmsvc
[edit] Standard VM operations
vim-cmd vmsvc/power.getstate vmId
vim-cmd vmsvc/power.on vmId
vim-cmd vmsvc/power.off vmId
vim-cmd vmsvc/power.suspend vmId
vim-cmd vmsvc/power.reset vmId
vim-cmd vmsvc/power.shutdown vmId
vim-cmd vmsvc/power.reboot vmId
vim-cmd vmsvc/power.hibernate vmId
vim-cmd vmsvc/snapshot.create vmId snapshotName snapshotDescription includeMemory
Ex:
vim-cmd "vmsvc/snapshot.create XXXX FIRST_SNAPSHOT MY_FIRST_SNAPSHOT_1"
vim-cmd vmsvc/snapshot.revert VmId snapshotLevel snapshotIndex
Ex:
vim-cmd "vmsvc/snapshot.revert XXXX 1"
vim-cmd vmsvc/snapshot.removeall VmId
vim-cmd vmsvc/snapshot.remove VmId removeChildren snapshotLevel snapshotIndex
vim-cmd vmsvc/snapshot.get vmId
[edit] Remove a VM
vim-cmd vmsvc/unregister vmId
then delete the vm directory from the datastore (/vmfs/...)
[edit] Maintenance mode for ESX host
    • (unfortunately this command will not evacuate/VMotion your VMs to rest of the cluster)
vim-cmd hostsvc/maintenance_mode_enter
vim-cmd hostsvc/maintenance_mode_exit
[edit] show the DCUI (direct console user interface)
dcui

Ctrl-C to exit

[edit] Enable SSH (from terminal)
vi /var/run/inetd.conf
uncomment ssh line (remove # from line that starts with #ssh)
save the file (:wq)
restart inetd
kill -HUP `ps | grep inetd`
[edit] Remove/Add SSH enabled warnings

To disable these warnings using esxcli:

esxcli system settings advanced set -o /UserVars/SuppressShellWarning -i 1 

To enable these warnings using esxcli:

esxcli system settings advanced set -o /UserVars/SuppressShellWarning -i 0
[edit] Change hostname
~$ esxcli system hostname set --host=hostname
~$esxcli system hostname set --fqdn=fqdn.com
Personal tools
Namespaces

Variants
Actions
Navigation
Mediawiki
Confluence
DevOps Tools
Ubuntu
Ubuntu 22
Mac OSX
Oracle Linux
AWS
Windows
OpenVPN
Grafana
InfluxDB2
TrueNas
OwnCloud
Pivotal
osTicket
OTRS
phpBB
WordPress
VmWare ESXI 5.1
Crypto currencies
HTML
CSS
Python
Java Script
PHP
Raspberry Pi
Canvas LMS
Kaltura Media Server
Plex Media Server
MetaSploit
Zoneminder
ShinobiCE
Photoshop CS2
Fortinet
Uploaded
Certifications
General Info
Games
Meal Plans
NC Statutes
2020 Election
Volkswagen
Covid
NCDMV
Toolbox