I thought we had some sample code posted on Code Central but now I cant find it,,;( What language were you needing this in.. ?
Thanks for your response. I need java example for assigning IP address to VM and I did not find any sample code yet.
Can you give me a sample code for that?
I asked our SDK Dev Support to lend a hand,,, Java it is,, anyone for C# ?
Thank you very much!!!
Please find the attached sample code that our dev team cooked up.
In this class, look for “deployVMFromTemplate” method. That
method contains “CustomizationIPSettings” object, and we are setting the IP of
that object to DHCP IP. To make it static instead of setting its IP to
“CustomizationDhcpIpGenerator”, the user needs to set it to
“CustomizationFixedIp” which has “ipAddress” as its property.
DeployVMFromTemplate.java 39.0 K
There's only one field named ipAddress in CustomizationFixedIp, and how to specify netmask and gateway? Thanks.
Have you got the exact code to assign static IP?
Here's some sample code leveraging vSphere Management SDK for Java to assign static IP to a VM as part of cloning an existing template to create the new VM.
The code samples from above link are not from me. Besides, ensure that VMware tools are installed in your template (i.e. in the VM you use for template creation). Since assigning an IP to a VM is an operation on the guest OS, you need VMware tools to be able to pass the values to the guest OS.