How to enable MAC address spoofing on a Hyper-V 2012 R2 Virtual Machine using PowerShell

I recently had to enable MAC address spoofing on the network adapters of two virtual machines deployed on Hyper-V 2012.  Here’s how I did it using PowerShell:

First, use the following command to take a look at the current configuration of our network adapter

Get-VMNetworkAdapter -VMName  VirtualMachineName –ComputerName HyperVHostName |fl Name,MacAddressSpoofing

MAS-1

  • VMName = Virtual Machine Name
  • Computer Name = Hyper-V host name

MAS-2

  • Name = Virtual Network Adapter Name

We can see that MacAddressSpoofing is currently Off

Run the following command to turn MacAddressSpoofing On

Set-VMNetworkAdapter  VMName VirtualMachineName –ComputerName HyperVHostName –VMNetworkAdapter  NetworkAdapterName -MacAddressSpoofing On

MAS-3

Re-run the following command to verify MacAddressSpoofing is On

Get-VMNetworkAdapter -VMName  VirtualMachineName –ComputerName HyperVHostName |fl Name,MacAddressSpoofing

MAS-4

One thought on “How to enable MAC address spoofing on a Hyper-V 2012 R2 Virtual Machine using PowerShell

Leave a Reply

Your email address will not be published. Required fields are marked *