VMware Cloud Community
Subnet88
Enthusiast
Enthusiast
Jump to solution

guestcustomizationsection.Adminpassword not available.

Hi All,

Am am attempting to retrieve the "AdminPassword" for a virtual machine via vCenter orchestrator, however it appears to be missing from the GuestCustomizationSection XML, and is therefore returning null. The password IS available via the native vCloud Director UI. Does anybody have any ideas? XML of vm.getGuestCustomizationSection is below

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<ns6:GuestCustomizationSection xmlns="http://www.vmware.com/vcloud/versions" xmlns:ns2="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ns3="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:ns4="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ns5="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:ns6="http://www.vmware.com/vcloud/v1.5" xmlns:ns7="http://www.vmware.com/schema/ovf" xmlns:ns8="http://schemas.dmtf.org/ovf/environment/1" xmlns:ns9="http://www.vmware.com/vcloud/extension/v1.5" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://redacted.com/api/vApp/vm-4a810f66-524c-4d2e-b031-a4ea99e4ae21/guestCustomizationSection/" ns2:required="false">

    <ns2:Info>Specifies Guest OS Customization Settings</ns2:Info>

    <ns6:Enabled>true</ns6:Enabled>

    <ns6:ChangeSid>true</ns6:ChangeSid>

    <ns6:VirtualMachineId>4a810f66-524c-4d2e-b031-a4ea99e4ae21</ns6:VirtualMachineId>

    <ns6:JoinDomainEnabled>false</ns6:JoinDomainEnabled>

    <ns6:UseOrgSettings>false</ns6:UseOrgSettings>

    <ns6:AdminPasswordEnabled>true</ns6:AdminPasswordEnabled>

    <ns6:AdminPasswordAuto>true</ns6:AdminPasswordAuto>

    <ns6:ResetPasswordRequired>false</ns6:ResetPasswordRequired>

    <ns6:ComputerName>Sm-VM-2K8R2-Sp1</ns6:ComputerName>

    <ns6:Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://redacted.com/api/vApp/vm-4a810f66-524c-4d2e-b031-a4ea99e4ae21/guestCustomizationSection/"/>

</ns6:GuestCustomizationSection>

0 Kudos
1 Solution

Accepted Solutions
Burke-
VMware Employee
VMware Employee
Jump to solution

The password was removed from the vCloud Director api for a brief period.... I submitted a bug regarding this quite some time ago. In newer versions of vCloud Director, the password IS where you are looking for it. You should be able to find the adminPassword text if you GET <path to your vApp>/ovf

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter

View solution in original post

0 Kudos
8 Replies
Burke-
VMware Employee
VMware Employee
Jump to solution

The password was removed from the vCloud Director api for a brief period.... I submitted a bug regarding this quite some time ago. In newer versions of vCloud Director, the password IS where you are looking for it. You should be able to find the adminPassword text if you GET <path to your vApp>/ovf

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
Subnet88
Enthusiast
Enthusiast
Jump to solution

Thanks Burke,

Do you have a list of versions affected by this? I am running v 5.1.2.1068441

0 Kudos
Subnet88
Enthusiast
Enthusiast
Jump to solution

Sorry, Also, Would you be able to provide sample code for performing the GET from VCO against a vCLoud:VM Object please?

0 Kudos
Burke-
VMware Employee
VMware Employee
Jump to solution

I think 5.1.2 is the only affected release.. It was fixed after I and other escalated the issues it caused for api users. When 5.1.3 gets released in the near future, this fix will be included. vCD 5.5 already has this fixed.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
Subnet88
Enthusiast
Enthusiast
Jump to solution

Thank you.

Would you happen to be able to provide an example of retrieving the Admin password via an HTTP GET on a vCloud:VM object?

0 Kudos
Burke-
VMware Employee
VMware Employee
Jump to solution

Actually, you cannot get the info from the vm, only from the vApp. This is because vCloud Director's lossless vApp contains all the details, individual VMs are not exported. So, get your vCloud:VApp object as "vapp" for example, then get its href. From there, you can retrieve the vApp OVF XML which will have the adminPassword field in it.. this of course means you'll need to do a bit of XML parsing Smiley Wink

var host = vapp.getHost();

var vappUrl = vapp.href;

var vAppOvfXmlString = host.get(vappUrl + "/ovf);

// Do your XML parsing here...

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
Subnet88
Enthusiast
Enthusiast
Jump to solution

The code below returns null in the System.log. I would assume it should be returning something...

vApp = vm.parent

var host = vApp.getHost();

var vappUrl = vApp.href;

var vAppOvfXmlString = host.get(vappUrl + "/ovf");

System.log(vAppOvfXmlString)

0 Kudos
Burke-
VMware Employee
VMware Employee
Jump to solution

Oops.. forgot about that ... for some silly reason, the host.get method can get the href of many objects with no problem, but adding /ovf to that url and trying to get it results in a null Smiley Sad Sorry... The ugly work-around that we have had to use in the past is using the HTTP-REST plug-in and Christophe's special invoke operation workflow found here: com.vmware.coe.rest.vcd51Invoke.package I just went through and tested everything myself from getting the null by trying the host.get method to getting the xml output from using the HTTP-REST call.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos