VMware {code} Community
nsyed4
Contributor
Contributor

How do I get UUID of newly created Virtual Machine?

ManagedObjectReference taskmor = vimPort.createVMTask(vmFolderMor,

                vmConfigSpec, resourcepoolmor, hostmor);

String msg = null;

        String[] opts = new String[] { "info.state", "info.error" };

        String[] opt = new String[] { "state" };

        Object[] result = results.waitForValues(taskmor, opts, opt,

                new Object[][] { new Object[] { TaskInfoState.SUCCESS,

                        TaskInfoState.ERROR } });

        if (result[0].equals(TaskInfoState.SUCCESS)) {

        msg = "Success: VM [" + virtualMachineName+ "] created.";

        } else {

            msg = "Failure: Creating [ " + virtualMachineName + "] ";

      }

I am using JAX-WS client stubs.

The Virtual machine got created. How do I get the UUID of the virtual machine. And how do I know the state of the virtual machine such as virtual machine already exists. It just says it failed.

Thanks for help.

0 Kudos
0 Replies