Automation

 View Only
  • 1.  Get network adapter & port

    Posted Mar 18, 2020 11:25 AM

    Hello,

    Not sure if possible,

    I need something similar to Get all Vlan for the host and network info

    I need to get port and network adapter info from list of VM (txt file).

    Almost same info from previous script but with VM and from list.

    Thanks



  • 2.  RE: Get network adapter & port

    Posted Mar 18, 2020 12:10 PM

    Can you indicate exactly which properties you want to see?

    The port number, for example, will only work if the VM is connected to a VDS, not with a VSS.



  • 3.  RE: Get network adapter & port

    Posted Mar 18, 2020 12:27 PM

    Hi LucD,

    I would like to see in Hardware-Network Adapters, Network label (in Network Connection) with port.

    Basically I can see those fields when I click Edit Setting for VM in Vcenter.

    Thanks



  • 4.  RE: Get network adapter & port

    Posted Mar 18, 2020 03:33 PM

    The settings on the Network Adapter you mean?



  • 5.  RE: Get network adapter & port
    Best Answer

    Posted Mar 18, 2020 04:52 PM

    Start with the following, and let me know what is eventually missing?

    Get-VM -PipelineVariable vm  | Get-NetworkAdapter -PipelineVariable vnic |

    Select @{N='VM';E={$vm.Name}},

        @{N='vNIC';E={$vnic.Name}},

        ConnectionState,MacAddress,

        @{N='SwitchName';E={(Get-VirtualPortgroup -Name $_.NetworkName).VirtualSwitch.Name}},

        @{N='PGName';E={$_.NetworkName}},

        @{N='PGPort';E={$_.ExtensionData.Backing.Port.PortKey}}



  • 6.  RE: Get network adapter & port

    Posted Apr 01, 2020 09:31 AM

    Thanks a lot LucD, this is exactly what I need.