And that my friends is GREAT. Basically that means you can create a a VM Network Adapter in Hyper-V while the VM is running (also a new feature), give it a name and enable Device Naming on the VM Network Adapter and then inside the VM find the Network Adapter using PowerShell and configure it without using the Mac Address as the identification.
Create the Network Adapter:
- Create the NIC while the VM is running (just for the fun of it) using PowerShell
- Add-VMNetworkAdapter -VMName SRV101 -SwitchName UplinkSwitch -Name MikesNIC01 -Verbose
- Enable Device Naming
- Set-VMNetworkAdapter -VMName SRV101 -Name MikesNIC01 -DeviceNaming On -Verbose
- Verify Device Naming using PowerShell, or Settings, or directly in the Hyper-V Manager
- Get-VMNetworkAdapter -VMName SRV101 | Format-List Name, DeviceNaming
Log in to the VM:
Using PowerShell you can now get the network adapter name in the VM with the name gave network adapter in the parent partition.
- Get-NetAdapterAdvancedProperty -Name * | Where-Object -FilterScript {$_.DisplayValue -LIKE “Mike*”}
You can also see this as properties in the Network Adapter.
Summary:
This gives us an easier way to automate the creation/configuration of VMs when it comes to handing over a task from the host to a VM when building solutions.
/mike
Categories: Hyper-V, PowerShell, Windows Server vNext
beautiful!!