We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1
VMware ESXi Command Line Cheat Sheet
General Management Snapshots Network
Get ESXi build and version numbers Restart Management, HA Services List all VM snapshots List VM networking information esxcli system version get /sbin/services restart vim-cmd vmsvc/snapshot.get <vmid> esxcli network vm list Get host hostname, domain, and FQDN List Virtual Machines (VMIDs) Create snapshot for running VM Get IPv4 configuration for all interfaces on host esxcli system hostname get vim-cmd vmsvc/getallvms vmware-cmd vmsvc/snapshot createsnapshot "New Snaphot Name" "Snapshop Description" <vmid> <snapshotid> esxcli network ip interface ipv4 get Get date and time ESXi was installed List running VMs with world ID Create snapshot for running VM, with RAM Get firewall state esxcli system stats installtime get esxcli vm process list vim-cmd vmsvc/snapshot.create <vmid> "New Snaphot Name" "Snapshop Description" includeMemory esxcli network firewall get List local users on ESXi host Terminate VM process (forcibly powers off VM) Delete a snapshot Disable firewall esxcli system account list esxcli vm process kill vim-cmd vmsvc/snapshot.remove <vmid> <snapshotid> esxcli network firewall set –enabled true | false Create local ESXi user Power On Retrieve Snapshot Removal Task ID Get firewall rules esxcli system account add -d="Description" -i="username" vim-cmd vmsvc/power.on <vmid> vim-cmd vimsvc/task_list (to get task ID) esxcli network firewall ruleset list -p="password" -c="password" Power Off (Soft) Monitor Removal of Snapshot Get firewall rules piped to awk List available commands with descriptions vim-cmd vmsvc/power.off <vmid> vim-cmd vimsvc/task_info <task ID> esxcli network firewall ruleset list | awk '$2 =="true"' esxcli command getdetails Power Off (Hard) Remove all snapshots Activate ESXi Firewall Ruleset List all available namespaces with corresponding commands esxcli vm process kill -w [worldID] -t [soft,hard,force] vmware-cmd /vmfs/volumes/local0/Example/Example.vmx removesnapshots esxcli network firewall ruleset set --ruleset-id=sshClient --enabled=true esxcli esxcli command list Reboot VM Check if volume is native snaphot capable Specify allowed IP Range for SSH Check maintenance mode vim-cmd vmsvc/power.reboot <vmid> vmkfstools -Ph /vmfs/volumes/exampledatastore/ esxcli network firewall ruleset allowedip add --ruleset-id sshServer --ip-address 10.10.0.0/24 esxcli system maintenanceMode get Suspend VM List Kernel Network Interfaces Enable/Disable maintenance mode vim-cmd vmsvc/power.suspend <vmid> esxcli network ip interface list esxcli system maintenanceMode set –enable true Resume VM List physical Network Interfaces Reboot/Restart ESXi host vim-cmd vmsvc/power.suspendResume <vmid> esxcli network nic list esxcli system shutdown reboot -r "message" Reset VM ESXi Kernel modules Shutdown physical network interface Reboot/Restart ESXi maintenance mode host with countdown timer vim-cmd vmsvc/power.reset <vmid> List loaded kernel modules esxcli network nic down -n <vmnicid> esxcli system shutdown reboot -d 10 -r "Patch Updates" Shutdown VM vmkload_mod -l List host routing table Get CPU information of host (family, model, and cache) vim-cmd vmsvc/power.shutdown <vmid> List kernel interfaces esxcli network ip route ipv4 list esxcli hardware cpu list Show VM info summary esxcfg-vmknic -l Add static route to esxi host Get memory information (available and non-uniform memory access) vim-cmd vmsvc/get.summary <vmid> Utility for capturing VMkernel events esxcli network ip route ipv4 add --gateway 10.10.1.1 --network 10.10.0.0/24 esxcli hardware memory get Check Host Performance vmkeventd Set ESXi host default gateway Configuration of and information about syslog esxtop Utility for logging VMkernel events esxcfg-route -a default 192.168.254.1 esxcli system syslog Check storage I/O performance vmklogger Test ESXi host default gateway Generate support and log information bundle from host vscsiStats Display physical adapters with link state and MAC addresses vmkping -D vm-support esxcfg-nics -l , esxcfg-vswitch -l, esxcfg-vmknic -l Send ICMP request Create Kernel interface with specfic MAC and IP Address and add it to portgroup vmkping –I <vmninterfaceid> <ipaddress> esxcfg-vmknic -a -i 10.10.1.2 -n 255.255.254.0 -M 00:11:22:aa:bb:cc -p <portgroupname> Test host connectivity to specific port Enable added portgroup nc –z <ipaddress> <port> Install Software Host Services esxcfg-vmknic -p <portgroupname> -e true List arp cache Lists currently installed software and drivers (VIBs) on ESXi Enable ESXi shell Delete Kernel interface esxcli network ip neighbor list esxcli software vib list vim-cmd hostsvc/enable_esx_shell esxcfg-vmknic -d -p <portgroupname> Clear arp cache entry Install package (VIB) Disable ESXi shell List all enabled kernel modules esxcli network ip neighbor remove -a <ipaddress> -v <IP version number> esxcli software vib install -v file:/tmp/[NewVIB].vib vim-cmd hostsvc/disable_esx_shell esxcfg-module -q List virtual switches Uninstall VIB Start ESXi shell Get parameters of a kernel modul, i.e. an Emulex FC HBA module esxcli network vswitch standard list esxcli software vib remove -n VIBname vim-cmd hostsvc/start_esx_shell esxcfg-module -g <kernelmodulename> Change physical uplink of vSwitch Update installed VIB on ESXi Enable the SSH daemon Set kernel module parameters esxcli network vswitch standard uplink remove/add -u <vmnicid> -v <vswitchid> esxcli software vib update -d “/tmp/update.zip” vim-cmd hostsvc/enable_ssh esxcfg-module -s "lpfc0_lun_queue_depth=8 lpfc1_lun_queue_depth=8 List portgroups Install patch Disable SSH daemon lpfc2_lun_queue_depth=8 lpfc3_lun_queue_depth=8" <kernelmodulename> esxcli network vswitch standard portgroup list esxcli software vib install /tmp/[patchName].zip vim-cmd hostsvc/disable_ssh Show all kernel module information Add new portgroup to vSwitch Start SSH daemon esxcfg-module -i <kernelmodulename> esxcli network vswitch standard portgroup add -p "Portgroup_Name -v <vswitchid> vim-cmd hostsvc/start_ssh List Advanced Kernel Settings/Parameters Set Management Network Interface Enter Maintenance mode esxcli system settings advanced list -d esxcli network ip interface tag add -i <vmnicid> -t Management Storage vim-cmd hostsvc/maintenance_mode_enter Set Advanced Kernel Parameter Set VLAN id List current storage devices Exit Maintenance Mode esxcli system settings advanced set -o /UserVars/ExampleKernelParameter -i 0 esxcli network vswitch standard portgroup set --vlan-id <vlanidnumber> -p "Portgroup_Name" esxcli storage core device list vim-cmd hostsvc/maintenance_mode_exit Add Kernel interface to portgroup Set SNMP Community List all storage devices accessible by host esxcfg-vmknic –a -i <interfaceip> -n <interfacemask> "Portgroup_Name" esxcli system snmp set --communities "COMMUNITY_NAME" esxcli storage filesystem list Set SNMP Trap destintion Rename datastore esxcli system snmp set --targets 10.10.1.150/COMMUNITY_NAME vim-cmd hostsvc/datastore/rename <name> <new_name> Send test SNMP trap List all storage paths esxcli system snmp test esxcli storage core path list Virtual Disks Check SNMP State List storage pathes for specific drive Extend virtual disk esxcli system snmp get esxcli storage core path list -d <driveid> vmkfstools -X 1500G /vmfs/volumes/exampledatastore/Example/Example.vmdk Enable IPMI as SNMP source Generate list of all LUN paths currently connected to host Rename disk esxcli system snmp set --hwsrc sensors esxcli storage vmfs extent list mv Name.vmdk Name_changed.vmdk Enable CIM as SNMP source List all storage devices Clone disk esxcli system snmp set --hwsrc indications esxcli storage nmp device list vmkfstools -i Name_changed.vmdk -d zeroedthick Name_changed_clone.vmdk Enable ESXi Host SNMP Get hypervisor filesystem information Remove disk esxcli system snmp set --enable true vdf rm Name.vmdk Capture Network Packets on the a physical interface Get usage of hypervisor filesystem Jump to directory of VM and monitor activity of delta, flat, and sesparse files pktcap-uw --uplink <vmnicid> vdu cd /vmfs/volumes/esxdatastore0/vm/vmfs/volumes/510a4e43-4bf56f05-5a34-0034791e8a3/vm # watch -d 'ls -luth | grep -E "delta|flat|sesparse"' List all physical network interfaces List all HBAs Delete all snapshots and power off VM. Convert thick provisioned disk to thin disk. esxcli network nic list esxcfg-scsidevs -a vmkfstools -i /vmfs/volumes/exampledatastore/vm/diskname.vmdk -d thin /vmfs/volumes/exampledatastore/vm/diskname-thin.vmdk Enable iSCSI software adapter List all HBAs with WWNN and WWPN Delete VM thick disk esxcli iscsi software set –enabled true esxcli storage san fc list rm /vmfs/volumes/exampledatastore/vm/diskname-flat.vmdk.thick Verify iSCSI adapter is enabled Reset HBA and force fabirc logon Determine configured size of thin disk esxcli iscsi software get esxcli storage san fc reset -A <hbaid> ls -lh /vmfs/volumes/exampledatastore/vm/diskname-flat.vmdk List metrics for specific iSCSI adapter Check if attached storage LUN supports VAAI Determine used size of thin disk esxcli iscsi adapter param get -A <vmhbaid> esxcli storage core device vaai status get du -h /vmfs/volumes/exampledatastore/vm/diskname-flat.vmdk List established iSCSI sessions esxcli iscsi sessions