vSphere

 View Only
  • 1.  How to get VirtualMachine moid

    Posted Mar 22, 2013 04:04 PM

    I just started working with the MOB and learning about MOID's. I was hoping to get the VirtualMachine MOID. We have ESXi hosts with free license. Any way to get this? I just want to execute VirtualMachine.Interact.PowerOn and .Suspend.

    Example:

    https://balvmware1/mob/?moid=VirtualMachine

    Any ideas? Or is this justs available via vcenterserver?



  • 2.  RE: How to get VirtualMachine moid
    Best Answer

    Broadcom Employee
    Posted Mar 22, 2013 04:07 PM

    Yes, take a look at this article for details on retrieving MoRef ID http://www.virtuallyghetto.com/2011/11/vsphere-moref-managed-object-reference.html

    Regarding the suspend operation, you'll want to read this first http://www.virtuallyghetto.com/2011/06/dreaded-faultrestrictedversionsummary.html



  • 3.  RE: How to get VirtualMachine moid

    Posted Mar 22, 2013 04:19 PM

    ahh ok. so it looks like my venture will immediately come to an end based on the free version API restrictions. darn.

    All I wanted to do was have bacula run "BeforeJob: {suspend VM}" and "AfterJob: {start VM}"

    Virtually ghetto sounds fine and all but it seems like a lot less work to do it this way. I really just wanted to port this from vmware server to vsphere:

    http://wiki.bacula.org/doku.php?id=application_specific_backups:vmwareserver



  • 4.  RE: How to get VirtualMachine moid

    Broadcom Employee
    Posted Mar 22, 2013 04:25 PM

    You can still perform the suspend operation, but you'll need to directly SSH into the ESXi Shell and use the vim-cmd (http://www.virtuallyghetto.com/p/vmware-vimsh_9940.html)



  • 5.  RE: How to get VirtualMachine moid

    Posted Feb 15, 2017 09:13 PM

    You can find moid at the address field in web browser when you select VM in vCenter WebClient. See screenshot.



  • 6.  RE: How to get VirtualMachine moid

    Posted Sep 23, 2020 08:54 PM

    Real paranoia greying out half of screen.. but answer to the point :smileyhappy:



  • 7.  RE: How to get VirtualMachine moid

    Posted Feb 20, 2020 02:36 AM

    Assuming ssh access is enabled you can ssh into your esx server from a bash terminal i.e...

    ssh {ESX IP Address}

    Once logged you can run the following command...

    vim-cmd vmsvc/getallvms

    Which will produce a list of virtual machines on the server. The moid is in the first column.