deepakmits
Contributor
Contributor

getting cannot complete customization of existing windows VM using vim java api.

Hi, I am using below given customization spec for customizing existing windows VM. and getting cannot complete customization . Can somebody tell me what is wrong here in code ?

CustomizationSpec cuSpec = new CustomizationSpec();

        List<CustomizationAdapterMapping> adaptors = new ArrayList<CustomizationAdapterMapping>();

          for (int i=0; i<2; i++) {

            CustomizationAdapterMapping caMapping = new CustomizationAdapterMapping();

            CustomizationIPSettings cIPSettings = new CustomizationIPSettings();

            if ((ipAddress != null) && (ipAddress.length() > 0))

            {

              CustomizationFixedIp cFixedIP = new CustomizationFixedIp();

              cFixedIP.setIpAddress(ipAddress);

              cIPSettings.setIp(cFixedIP);

            }

            else {

              CustomizationDhcpIpGenerator cDhcpIPGen = new CustomizationDhcpIpGenerator();

              cIPSettings.setIp(cDhcpIPGen);

            }

            cIPSettings.getGateway().addAll(gateway);

            cIPSettings.setSubnetMask(subnetMask);

            cIPSettings.setDnsDomain(dnsDomain);

            cIPSettings.getDnsServerList().addAll(dnsServerList);

            caMapping.setAdapter(cIPSettings);

            adaptors.add(caMapping);

          }

          CustomizationGlobalIPSettings cgIP = new CustomizationGlobalIPSettings();

          if ((adaptors.size()>0)) {

            cgIP.getDnsSuffixList().addAll(dnsSuffixList);

            cgIP.getDnsServerList().addAll(dnsServerList);

            cuSpec.setGlobalIPSettings(cgIP);

            cuSpec.getNicSettingMap().addAll(adaptors);

          }

         

          CustomizationUserData cud = new CustomizationUserData();

          CustomizationGuiUnattended cgu = new CustomizationGuiUnattended();

          //setting hostname

          CustomizationFixedName cfn = new CustomizationFixedName();

          cfn.setName(hostName);

          cud.setComputerName(cfn);

         

          //setting fullname and orgname

          cud.setFullName(fullName);

          cud.setOrgName(orgName);

          //setting prodId

          cud.setProductId(prodId);

          //setting workgroupname

          CustomizationIdentification custIdentification = new CustomizationIdentification();

          custIdentification.setJoinWorkgroup(workgroupName);

         

          CustomizationLicenseFilePrintData licenseFilePrintData = new CustomizationLicenseFilePrintData();

          licenseFilePrintData.setAutoMode(CustomizationLicenseDataMode.PER_SERVER);

          licenseFilePrintData.setAutoUsers(5);

         

          CustomizationWinOptions cwOptions = new CustomizationWinOptions();

          cwOptions.setChangeSID(true);

          cwOptions.setDeleteAccounts(false);

          cuSpec.setOptions(cwOptions);

           

          //creating sysprep

          CustomizationSysprep sysPrep = new CustomizationSysprep();

          sysPrep.setIdentification(custIdentification);

          sysPrep.setUserData(cud);

          sysPrep.setGuiUnattended(cgu);

          sysPrep.setLicenseFilePrintData(licenseFilePrintData);

          //set sysprep to customization spec

          cuSpec.setIdentity(sysPrep);

       

          boolean vmCustomized = false;

Thanks in advance.

-Deep

0 Kudos
0 Replies