VMware Cloud Community
ngerasimatos
Contributor
Contributor

ESX loses multiple IP addresses aliases when cloning

When I clone a VM only the primary IP assigned to a NIC is copied, the new VM doesn't retain the multiple IP aliases I have specified under advanced settings in Windows Server 2003 OS. I know I can just create more NIC's and assign the IP's that way, but I would rather not go that route.

Reply
0 Kudos
4 Replies
danm66
Expert
Expert

Are you choosing to customize the VM? I recall there being a problem with sysprep and it creating new NIC's within windows so the existing settings don't get carried over.

Reply
0 Kudos
ngerasimatos
Contributor
Contributor

Yes, as I am cloning the machine I am customizing it. The single IP for the NIC carries over, but all of the IP aliases do not. That forces me to log into Windows after and add the IPs again, which is a huge pain as some of these web servers have many IPs.

Reply
0 Kudos
danm66
Expert
Expert

you can verify that it's sysprep causing your issue by cloning without customizing. If it doesn't repeat the behavior, then you know that it's sysprep messing you up and maybe work on a custom script with netsh commands to restore the IP info.

ngerasimatos
Contributor
Contributor

Any idea on how to write a script that will punch in the IPs based on hostname? I know I can do something similar to the following but any suggestions are appreciated.

$VIServer = Read-Host “vCenter IP: ”

Connect-VIServer $VIServer

$HostCred = $Host.UI.PromptForCredential(“Please enter credentials”, “Enter ESX host credentials”, “”, “”)

$GuestCred = $Host.UI.PromptForCredential(“Please enter credentials”, “Enter Guest credentials”, “”, “”)

$PrimaryDNS = Read-Host “Primary DNS: ”

$SecondaryDNS = Read-Host “Secondary DNS: ”

get-vm | %{ $_.Name; $_ | Invoke-VMScript -HostCredential $HostCred -GuestCredential $GuestCred -ScriptType “bat” -ScriptText “netsh interface ip set dns “”Local Area Connection”" static $PrimaryDNS && netsh interface ip add dns “”Local Area Connection”" $SecondaryDNS && netsh interface ip delete wins “”Local Area Connection”" }

Reply
0 Kudos