Hyper-V host virtual net adapter

Welcome Forums General PowerShell Q&A Hyper-V host virtual net adapter

This topic contains 1 reply, has 1 voice, and was last updated by

 
Participant
1 year, 3 months ago.

  • Author
    Posts
  • #77664

    Participant
    Points: 0
    Rank: Member

    How do you get a handle to the virtual network adapter on the host that is connected to a given internal VM switch? The only way I can figure out is to look for one named "vEthernet ($switchName)", but it's not very robust, as Hyper-V allows you to create switches with duplicate names, and I'm not sure if this naming scheme is consistent across versions. Hyper-V must keep a record of this somewhere as it will automatically remove the correct virtual net adapter when the VM switch is removed, but I wasn't able to find it after a fair bit of digging.

  • #77682

    Participant
    Points: 0
    Rank: Member

    The answer is to look for it in VM network adapters instead of the host's network adapter list:

    Get-VMNetworkAdapter -ManagementOS | where SwitchName -eq $switchName
    

The topic ‘Hyper-V host virtual net adapter’ is closed to new replies.