VMware Cloud Community
tdubb123
Expert
Expert
Jump to solution

$esxcli.network.nic.list()

trying to get a list of my nic

$vmhosts = get-cluster "XXX" | get-vmhost

foreach ($vmhost in $vmhosts) {

$esxcli = get-esxcli -vmhost $vmhost

$esxcli.network.nic.list() | select *

}\

how do I add the vmhost in there?

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this

$vmhosts = Get-Cluster "xxx" | Get-VMHost

foreach ($vmhost in $vmhosts) {

    $esxcli = Get-EsxCli -VMHost $vmhost

    $esxcli.network.nic.list() |

        select @{N='VMHost';E={$esxcli.VMHost.Name}},*

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
5 Replies
LucD
Leadership
Leadership
Jump to solution

Try like this

$vmhosts = Get-Cluster "xxx" | Get-VMHost

foreach ($vmhost in $vmhosts) {

    $esxcli = Get-EsxCli -VMHost $vmhost

    $esxcli.network.nic.list() |

        select @{N='VMHost';E={$esxcli.VMHost.Name}},*

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
tdubb123
Expert
Expert
Jump to solution

nice. Thanks Luc

0 Kudos
tdubb123
Expert
Expert
Jump to solution

hi lucd

any idea how I can get the host manufacturer and model added into this?

0 Kudos
tdubb123
Expert
Expert
Jump to solution

this is whast I have

$results = @()

$vmhosts = get-datacenter "xx" | get-vmhost

foreach($vmhost in $vmhosts) {

$result = $esxcli.network.nic.list() | select @{N="VMHost";E={$esxcli.vmhost.name}},*

$result += $results

}

$results | out-gridview

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Try like this

$vmhosts = get-datacenter "xxx" | get-vmhost

$report = foreach ($vmhost in $vmhosts) {

    $esxcli = Get-EsxCli -VMHost $vmhost

    $esxcli.network.nic.list() |

        select @{N='VMHost';E={$esxcli.VMHost.Name}},

            @{N='Manufacturer';E={$esxcli.VMHost.Manufacturer}},

            @{N='Model';E={$esxcli.VMHost.Model}},

            *

}

$report | Out-GridView


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos