I created a "ESXi Host VM (say esxi_vm_1)" on a physical ESXi host (IP = 10.20.30.1)
The virtual host had DHCP enabled and after successfully creating the VM and powering it ON, it obtained an IP address from DHCP pool (say 10.20.30.5)
Now I powered OFF the "esxi_vm_1" and then "cloned to template (Name=host_vm_template)".
After the template is successfully created, I am trying to create multiple ESXi Host VMs from the template, using the below code in vsphere powercli:
for ($i=2; $i -le 5; $i++){New-VM -VMHost 10.20.30.1 -Name esxi_host_$i -Template host_vm_template; start-vm esxi_host_$i}
The new VMs "esxi_host_2, esxi_host_3, esxi_host_4 and esxi_host_5" are all successfully created and started.
ISSUE:
When I go to each of the VMs and check the network configuration,
All of these new VMs IP address is "10.20.30.5"
Please let me know how I can avoid this and assign a new IP address from the DHCP pool for each new VM that is created.
thanks
-gopi