Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 251313

Re: Clone VM using existing CustomizationSpec and changing ComputerName property

$
0
0

Did you post the source you're using to manipulate the CustomizationSysprep? I see a lot of

other code in that thread (which is greatly appreciated, BTW), but not that.

 

I did this a few years back, but in Java (using VI Java). I don't have access to that source anymore,

but it looked something like this:

 

if (identity instanceof CustomizationSysprep) {    CustomizationSysprep winIdentity = (CustomizationSysprep) identity;    CustomizationName name;    if (hostName != null) {      CustomizationFixedName fname = new CustomizationFixedName();      fname.setName(hostName);      name = fname;    }else{      name = new CustomizationVirtualMachineName();    }    winIdentity.getUserData().setComputerName(name);     }   

 

The trick is that UserData.computerName takes an object, not a name directly.

 

So if I had a "hostName" string, I used that as the computer name (via CustomizationFixedName), otherwise

I let vSphere name it based on the VM name (via CustomizationVirtualMachineName).

 

Hope this helps.


Viewing all articles
Browse latest Browse all 251313

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>