Link to home
Start Free TrialLog in
Avatar of kwhelp
kwhelpFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How to retain IP settings when using POWERCLI to change NIC adapter type.

Hi,
I have a script to shutdown selected VMs, change the NIC adapter type to VMXNET3 and then power back on. Problem is, the new NIC doesn't retain the IP settings. Script below. Any idea how I can dump out the IP config first and import it back in at the end? thanks.

$a = Get-Content "e:\vmps\serverlist.txt"
foreach ($i in $a)
{update-tools $i
Shutdown-VMGuest -VM $i -Confirm:$false
start-sleep -seconds 25
get-vm $i|get-networkadapter|set-networkadapter -type VMXNET3 -Confirm:$false
start-VM -VM $i}
ASKER CERTIFIED SOLUTION
Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial