VMware Cloud Community
jstroehmann
Contributor
Contributor
Jump to solution

How to get physical nic model name

I can see the model information for my nic through vcenter, but need help listing this info from powercli.

for example i am looking for my query to have this output:
"Broadcom Corporation NC370i Multifunction Gigabit Server Adapter"

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
mattboren
Expert
Expert
Jump to solution

Hello, jstroehmann-

How about something like:

## get the .Net View objects for all of the host systems
Get-View -ViewType HostSystem -Property Name,Config.Network.Pnic,Hardware.PciDevice | %{
    ## store pipeline variable for later use
    $viewHost = $_
    ## for each PhysicalNic on the host, output a bit of info
    $viewHost.Config.Network.Pnic | Select @{n="HostName"; e={$viewHost.Name}},Device,MAC,@{n="NicDisplayName"; e={$oPNic = $_; ($viewHost.Hardware.PciDevice | ?{$_.Id -eq $oPNic.Pci}).DeviceName}}
} |
ft -auto

It grabs the .Net View object of all of the HostSystems, and then displays some info like hostname, the VMNic name, its MAC address, and then the display name that you mentioned.  You could, of course, do something with the output other than send it to Format-Table.  How does that do for you?

View solution in original post

0 Kudos
2 Replies
mattboren
Expert
Expert
Jump to solution

Hello, jstroehmann-

How about something like:

## get the .Net View objects for all of the host systems
Get-View -ViewType HostSystem -Property Name,Config.Network.Pnic,Hardware.PciDevice | %{
    ## store pipeline variable for later use
    $viewHost = $_
    ## for each PhysicalNic on the host, output a bit of info
    $viewHost.Config.Network.Pnic | Select @{n="HostName"; e={$viewHost.Name}},Device,MAC,@{n="NicDisplayName"; e={$oPNic = $_; ($viewHost.Hardware.PciDevice | ?{$_.Id -eq $oPNic.Pci}).DeviceName}}
} |
ft -auto

It grabs the .Net View object of all of the HostSystems, and then displays some info like hostname, the VMNic name, its MAC address, and then the display name that you mentioned.  You could, of course, do something with the output other than send it to Format-Table.  How does that do for you?

0 Kudos
jstroehmann
Contributor
Contributor
Jump to solution

appears to work perfectly - much appreciated!

(EX output)
hostname.domain.com vmnic0 1c:a1:df:72:12:d7 NC370i Multifunction Gigabit Serve...

0 Kudos