Hello,
I look for some helpfull Powershell esxcli commands, maybe you can help me
- I want to receive the host vmnics crc error and the send and received counter.
$esxhost = "esx01"
$esxcli = Get-EsxCli -VMHost (Get-VMHost $esxhost) -V2
$esxcli.network.nic.stats???
maybe an arry of only connected vmnics with some more infos like crc error, reveiv and send counter
- I want to up and down a certian vmnic over powershell esxcli command
$esxhost = "esx01"
$esxcli = Get-EsxCli -VMHost (Get-VMHost $esxhost) -V2
$esxcli.network.nic.down???
thank you
To receive those counters, you could do
$esxName = 'esx01'
$esxcli = Get-EsxCli -VMHost $esxName -V2
$esxcli.network.nic.list.Invoke() |
ForEach-Object -Process {
$esxcli.network.nic.stats.get.Invoke(@{nicname=$_.Name}) |
Select @{N='VMHost';E={$esxcli.VMHost.Name}},
NICName,PacketsReceived,PacketsSent,ReceiveCRCerrors
}
To up/down a specific NIC you can do
$nicName = 'vmnic0'
$esxcli.network.nic.down.Invoke(@{nicname=$nicName})
$esxcli.network.nic.up.Invoke(@{nicname=$nicName})
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
To receive those counters, you could do
$esxName = 'esx01'
$esxcli = Get-EsxCli -VMHost $esxName -V2
$esxcli.network.nic.list.Invoke() |
ForEach-Object -Process {
$esxcli.network.nic.stats.get.Invoke(@{nicname=$_.Name}) |
Select @{N='VMHost';E={$esxcli.VMHost.Name}},
NICName,PacketsReceived,PacketsSent,ReceiveCRCerrors
}
To up/down a specific NIC you can do
$nicName = 'vmnic0'
$esxcli.network.nic.down.Invoke(@{nicname=$nicName})
$esxcli.network.nic.up.Invoke(@{nicname=$nicName})
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
perfect! Thanks Luc
new layout looks good here!
ah one more thing.
How can I reset a certain stat of a certian nic?
thanks luc
Afaik, there is no esxcli command to do that.
When you reboot the ESXi node, the counters are reset.
Another method that is used by some is to unload/load the NIC driver with the vmkload_mod command.
Note that this will interrupt your connection!
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference