VMware {code} Community
edmandsj
Enthusiast
Enthusiast
Jump to solution

How to get VirtualMachine moid

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?

1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

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

View solution in original post

Reply
0 Kudos
6 Replies
lamw
Community Manager
Community Manager
Jump to solution

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

Reply
0 Kudos
edmandsj
Enthusiast
Enthusiast
Jump to solution

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

Reply
0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

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)

Reply
0 Kudos
diflyon
Contributor
Contributor
Jump to solution

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

2017-02-16_00-07-50.png

Reply
0 Kudos
TonicAgency
Contributor
Contributor
Jump to solution

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.

petergsk
Enthusiast
Enthusiast
Jump to solution

Real paranoia greying out half of screen.. but answer to the point Smiley Happy

Reply
0 Kudos