• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Yellow Bricks

by Duncan Epping

  • Home
  • ESXTOP
  • Stickers/Shirts
  • Privacy Policy
  • About
  • Show Search
Hide Search

ESXi commandline work….

Duncan Epping · Nov 16, 2011 ·

I am just playing around in my lab and needed to do a couple of common ESXi commandline tasks which I figured I would document as they will come in handy at some point.

  • List all VMs registered to this host (This reveals the Vmid needed for other commands)
    vim-cmd /vmsvc/getallvms
  • Unregister a VM
    vim-cmd /vmsvc/unregister <Vmid>
  • Register a VM
    vim-cmd /solo/register /path/to/file.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>

Related

Server 5, 5.0, esxi, troubleshooting, VMware

Reader Interactions

Comments

  1. tom miller says

    16 November, 2011 at 16:18

    Thanks. Nice to know the replacement comand for vmware-cmd. Have to figure out how to commit a snapshot from the command line. vCenter looses track of large snapshot commits

    Thanks

  2. Askar Kopbayev says

    17 November, 2011 at 00:04

    Interestingly, when you unregister a VM hosted on EXSi server which is registered with vCenter you will get orphaned VM in vCenter inventory.

  3. Forbes Guthrie says

    17 November, 2011 at 02:12

    Thanks Duncan, very handy.
    VMware’s ESXi 5.0 reference poster that they gave away at VMworld unfortunately lists all the vmware-cmd commands.
    Although there is no esxcli replacement for these ones yet, I like the esxcli vm process list one. Its my “always run this as a quick check before I reboot the server” rule 🙂

  4. Forbes Guthrie says

    19 November, 2011 at 22:46

    BTW, according to this document (last page):
    http://pubs.vmware.com/vsphere-50/topic/com.vmware.ICbase/PDF/vsphere-esxi-vcenter-server-50-command-line-management-for-service-console-users.pdf

    The “vmware-cmd” command is still available in the vCLI (and presumably by extension in vMA 5.0 although I haven’t checked), just not on the ESXi shell. No doubt it will get removed soon and replaced with an esxcli command, but I thought I would point it out as its an inconsistency which is likely to cause confusion.

    Incidentally the section above that in the PDF talks about an “esxcli filesystem vmfs” which I couldn’t see.

  5. Jeremy Oakey says

    29 November, 2011 at 17:29

    I’ll add one experience I’ve had before when using these handy cli commands. I had put a host in Maintenance mode the night before but had forgotten and couldn’t get my vCenter VM to power on via the vmsvc/power.on method the next day. When your host is in Maintenance Mode, and you use the power.on command, you receive a very generic “Power On Failed” error message.

    You can check the maintenance mode status of the host using
    ‘vim-cmd hostsvc/hostsummary | grep Maintenance’

    and you’ll see a true or false line returned by the command – “inMaintenanceMode = true”

    You can exit maintenance mode so that the power.on command will work using
    ‘vim-cmd hostsvc/maintenance_mode_exit’

    (and ‘vim-cmd hostsvc/maintenance_mode_enter’ is the command to enter maintenance mode)

  6. Darren says

    8 January, 2013 at 23:50

    Hello there Duncan,
    I have been using vSphere for some years now and would like to get more in trenched in the command line admin for esxi.
    Is there a more robust list of commands that I can access in the same style as you have doco’d here? or a good site that will help me learn the command line for esxi over the next 357 days?

  7. trulyasian says

    20 March, 2014 at 18:03

    Thank you.Thank you.Thank you.Thank you.Thank you.Thank you.Thank you.Thank you.

    you are a life saver.

    I am trying to find a simple command to get all vms on a system, and web is full too much information about what you don’t need.

Primary Sidebar

About the author

Duncan Epping is a Chief Technologist in the Office of CTO of the Cloud Platform BU at VMware. He is a VCDX (# 007), the author of the "vSAN Deep Dive", the “vSphere Clustering Technical Deep Dive” series, and the host of the "Unexplored Territory" podcast.

Upcoming Events

May 24th – VMUG Poland
June 1st – VMUG Belgium
Aug 21st – VMware Explore
Sep 20th – VMUG DK
Nov 6th – VMware Explore
Dec 7th – Swiss German VMUG

Recommended Reads

Sponsors

Want to support Yellow-Bricks? Buy an advert!

Advertisements

Copyright Yellow-Bricks.com © 2023 · Log in