Change a Virtual NIC Type using PowerCLI

Blog 3: As there is an issue with Windows Server 2012/2012 R2 and the E1000 Network Card I found myself needing to replace the NICs of all of my Server 2012 VMs to use the VMXNET3 – I didnt want to shut down my whole infrastructure so came up with this method to change them whilst online.

1 – Ensure the VM is running the Current VMware Tools

  • Log in to vSphere Client, Highlight the Host name, and select the Virtual Machines tab
  • In the Master Pane on the right, right click any of the headings and tick VMware Tools Version Status, when this column is showing ensure that the VM you need to change shows Current as its status.

status

1.1 – If VMware Tools is Out-of-Date or Not Installed – Update/Install VMware tools.

  • Right click the VM that you need to change, hover over Guest
  • Select Install/Upgrade VMware Tools
  • Follow on screen instructions

installvmwt

2 – Launch PowerCLI and Connect to Host

  • Launch PowerCLI (available here if you do not have it already)
  • Run the command to connect to your Host:

                        connectviserver [HostFQDN/IP] (and press enter)

connectvi

  • If you get a certificate warning, just wait – this is for info only
  • Enter Credentials to connect (I personally use Host Root account)

3 – Get the VM’s Guest Network address (If you use DHCP skip to step 4)

  • From CLI run the following command:

    Get-VM [VMName] | Select Name, @{N=”IP Address”;E={@($_.guest.IPAddress[0])}}

  • To return the IP of All VMs, omit the VM Name prior to the pipe.

4 – Change the Network adapter type

  • Run one of the following commands:

Specific VM:
Get-VM [VM Name] | Get-NetworkAdapter | Set-NetworkAdapter -Type VMXNET3

Catch E1000 Only:
Get-VM  | Get-NetworkAdapter -Type E1000 | Set-NetworkAdapter -Type VMXNET3

Catch All:
Get-VM | Get-NetworkAdapter | Set-NetworkAdapter -Type VMXNET3

  • (I would suggest doing a handful of VMs one at a time before doing them in bulk)
  • If Windows does not detect the change Real-Time, then the VM may require a reboot to detect the change.

Hope you’ve found this helpful!
Until next time…..

Leave a comment