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
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
Thanks for sharing such great script.