VMware Cloud Community
esxi1979
Expert
Expert

Esxi NIC audit

Hi All

How can i get the below export for a node or cluster wise in xls

$VMhosts = Get-VMHost | Get-View

Foreach ($vmhost in $vmhosts){

   Write-Output $vmhost.Name

   $pnic = 0

   Do {   

      $Speed = $VMhost.Config.Network.Pnic[$pnic].LinkSpeed.SpeedMb   

      Write "Pnic$pnic $Speed"  

      $pnic ++

   } Until ($pnic -eq ($VMhost.Config.Network.Pnic.Length))}

i Tried &{ }   but no luck .. pls suggest

thx

Tags (1)
2 Replies
LucD
Leadership
Leadership

Try something like this

$clusterName = 'MyCluster'

Get-Cluster -Name $clusterName |

Get-VMHost | Get-VMHostNetworkAdapter |

where{$_.Name -match "^vmnic"} |

Select @{N='VMHost';E={$_.VMHost.Name}},Name,

    @{N='SpeedBps';E={$_.BitRatePerSec}} |

Export-Csv -Path ".\$($clusterName)-vmnic-report.csv" -UseCulture


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

AlbertWT
Virtuoso
Virtuoso

Thanks for sharing such great script.

/* Please feel free to provide any comments or input you may have. */
0 Kudos