VmWare/Misc Commands

From r00tedvw.com wiki
Jump to: navigation, search

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

Contents

List VMs (get vmIds)
vim-cmd vmsvc/getallvms
VM status
vim-cmd vmsvc/power.getstate vmId
Power on/off a VM
vim-cmd vmsvc/power.[on/off] vmId
Get the IP address of a VM
vim-cmd vmsvc/get.summary vmId | grep ipAddress
To list available commands
vim-cmd help
vim-cmd vmsvc
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
Remove a VM
vim-cmd vmsvc/unregister vmId
then delete the vm directory from the datastore (/vmfs/...)
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
show the DCUI (direct console user interface)
dcui

Ctrl-C to exit

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`
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
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