Ugh, it happened again!
I forgot to increase the MAC Address pool on a new lab server, and started to get VMs with the same MAC address in my environment. This time I figured that if I blog about it, I'm more likely to remember it next time 🙂
Background
When installing Hyper-V, it' sets up a MAC Address Pool of only 256 machines. That means, once you deploy virtual machine number 257, it's going to reuse an existing MAC Address. Not fun. Especially if that other VM is still around. You can see/edit the MAC address pool in the virtual switch manager, or via PowerShell.
Editing the MAC address pool via GUI.
Getting the MAC address pool via PowerShell.
The PowerShell command (for copy and paste) is:
Get-VMHost | Select MacAddressMinimum, MacAddressMaximum | ft
Checking for duplicates
If you think you are having machines with duplicate MAC address, simply run this script on your Hyper-V host to find out. Cred goes to Didier Van Hoye (@WorkingHardInIT) for the loop logic.
$AllNICs = Get-VM | Get-VMNetworkAdapter | Where-Object {$_.MacAddress -ne "000000000000"}
if($AllNICs -ne $null)
{
(($AllNICs).GetEnumerator() | Group-Object MacAddress | ? {$_.Count -gt 1}).Group | Ft MacAddress,Name,VMName -GroupBy MacAddress -AutoSize
}
Else
{
"No duplicated MAC addresses where found on your Hyper-V host"
}

Fixing it
The solution? Simply increase the MAC address pool, either in the GUI or in PowerShell. In this example I'm increasing it to 65536 machines. That should last a few weeks 🙂
Set-VMHost -MacAddressMinimum 00155D010000 -MacAddressMaximum 00155D01FFFF

Written by Johan Arwidmark