Changing Vlan seeting for one adapter in a VM is simple. All you have to do is to type something like this:

 Set-VMNetworkAdapterVlan –VMName MySimpleVM –Access –VlanId 10


Get-VMNetworkAdapter -VMName MySimpleVM | Set-VMNetworkAdapterVlan  –Access –VlanId 10

It’s the same with VmNetworkAdapterIsolation, VMNetworkAdapterRoutingDomainMapping, VMNetworkAdapterFailoverConfiguration.

But what happen if you have more than one adapter?

You will need to supply a VMNetworkAdapterName. If you have setup your VM from Hyper-vm manager, all adapters have the same name, “Network Adapter”. If you have VMM, it’s not a problem, you can rename you adapter in VMM.

If not, you will have to rename your adapter yourself.

First you will need to get the adapter mac address

get-vmnetworkadapter -vmname MySimpleVM | select switchname, macaddress

Here I use the switchname to identify the adapter, but you can also check the mac address in Hyper-v Manager.

Then you can modify the adapter name

get-vmnetworkadapter -vmname MySimpleVM | ?{$_.macaddress -eq "00155DXXXX11"} | Rename-VMNetworkAdapter -NewName MyNicPort

And know you can do whatever you want with your adapter

Set-VMNetworkAdapterVlan –VMName MySimpleVM –VMNetworkAdapterName MyNicPort –Access –VlanId 10