Search code examples
pythonvmwarevspherepyvmomi

Adding orphaned VMs to inventory using pyVmomi?


I've done a good bit of research over the last day or two, both on here and good ole Google and can't seem to find any examples of adding orphaned vms to inventory with pyVmomi(or any other vSphere module for that matter).

Thanks to some examples on github, I was able to FIND the orphaned vms using pyVmomi, but man.. pyVmomi doesn't have any good documentation.

So, now I'm going to post my own question!

Thanks for any tips/help!

-Chris Mulliner


Solution

  • You can call the folder.Register with the path to the vmx file like so:

    from pyVim import folder
    
    folder.Register("[datastore]TestVM/TestVM.vmx")