A. This has happened to me many times. I have a virtual machine (VM) and somehow I lose the configuration XML file, or I simply move the VM to another Hyper-V host. I create an identical VM with the same number of network interfaces, connected to the same networks, but all of my network configuration is gone.
When you think about it, this is how Hyper-V should behave. If you had a physical box and replaced the network card, the new card would have its own globally unique identifier (GUID) and its own MAC. It's exactly the same with VM configurations. The new network interface has its own GUID, which won't match the existing GUID in the OS's configuration, so the OS will see it as a new network card and make you perform the network configuration again.
The GUID and MAC of the network interface are part of the guest's XML configuration file. Look for the section of the file the file that contains the word "MacAddress," as shown here.
5633690d2a37\}</channelinstanceguid><br><friendlyname type="string">Network Adapter</friendlyname><br><isconnected type="bool">True</isconnected><br><macaddress type="string">00-15-5D-19-97-00</macaddress><br><macaddressisstatic type="bool">False</macaddressisstatic><br><portname type="string">516b5e58-cb6f-4cc4-a3aa-146514b328f9</portname><br><switchname type="string">2a846221-4669-4c9e-bd8b-558620b7ad49</switchname><br></_ccb3dbd5-428c-4fe4-8f4b-edb10a5fbc2a_>
The first line shows the GUID of the VM's network adapter. If you create a new VM, the GUID of the network adapter must match the GUID of the adapter in the old configuration to preserve your network configuration. This means you need to make sure you keep a backup of the configuration files for your VMs, or at least the network adapter GUIDs. If you were really stuck, you could actually boot the VM, configure device manager to show disconnected devices, and get the GUID from the network adapter properties. You could then configure a network adapter and force the GUID in its configuration. I'll discuss accessing disconnected devices in my next FAQ.
I should point out that tampering with the XML configuration files directly isn't really supported by Microsoft. Instead, you should use Windows Management Instrumentation to modify the network adapters. But editing the file worked fine for me.