To restore the virtual machine to the inventory, and make it usable again, you can use the RegisterVM_Task method, defined in the
Folder managed object. You can register the virtual machine to a host or to a resource pool. You can register the virtual machine as a template if you want to use it to clone other virtual machines from.
The ColdMigration.java sample illustrates both registering and reconfiguring a virtual machine. At the heart of the sample is the following call, which registers the virtual machine. Arguments include the virtual machine’s current folder, datastore path, and name, whether to register as a template, and the resource pool or host to register the machine in.
The RemoveManagedObject.java sample illustrates unregistering a virtual machine.