Reset the Network Stack in a Windows Virtual Machine Using PowerShell

When you change network settings in a Windows virtual machine, you must reset the network stack of the virtual NIC to adopt the new settings. For a Windows guest operating system, you must disable and re-enable the network connection so it adopts a new MAC address. To perform this task with PowerShell, use the Restart-NetAdapter cmdlet.

The cmdlet is described in more detail at https://technet.microsoft.com/en-us/itpro/powershell/windows/netadapter/restart-netadapter.

Procedure

  1. List the virtual network adapters in the guest operating system.
    Get-NetAdapter
    The names of the virtual network adapters appear in the first column of output.
  2. Restart the network adapter representing the external interface.
    Restart-NetAdapter -Name "Ethernet0"
  3. If you have more than one virtual interface, repeat the previous step for each one.