Hyper-V

PowerShell is King – vNext Hyper-V gets support for Network Device Naming

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

image

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.

image

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

1 reply »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.