Hi,
I want to ask is it a way how to get ESXi routing table via powerCLI from various (69) ESXi host?
thanks
If you need to stay with the older version, you could do
foreach($esx in Get-VMHost){
$esxcli = Get-EsxCli -VMHost $esx
$esxcli.network.ip.route.ipv4.list() |
select @{N='VMHost';E={$esx.Name}},*
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Does this bring what you want?
$esxcli = Get-EsxCli -VMHost MyEsx -V2
$esxcli.network.ip.route.ipv4.list.Invoke()
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
And if you want this for all your ESXi nodes, you could do something like this
foreach($esx in Get-VMHost){
$esxcli = Get-EsxCli -VMHost $esx -V2
$esxcli.network.ip.route.ipv4.list.Invoke() |
select @{N='VMHost';E={$esx.Name}},*
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
getting error
You cannot call a method on a null-valued expression.
At D:\_ivan\esxi-routing.ps1:3 char:5
+ $esxcli.network.ip.route.ipv4.list.Invoke() |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Does Get-VMHost return anything?
Are you connected to the vCenter?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
yes, I am, Get-vmhost its working normally.
Get-EsxCli : A parameter cannot be found that matches parameter name 'V2'.
At D:\_ivan\esxi-routing.ps1:2 char:39
+ $esxcli = Get-EsxCli -VMHost $esx -V2
+ ~~~
+ CategoryInfo : InvalidArgument: (:) [Get-EsxCli], ParameterBind
ingException
+ FullyQualifiedErrorId : NamedParameterNotFound,VMware.VimAutomation.ViCo
re.Cmdlets.Commands.GetEsxCli
Looks like you are on an older PowerCLI version (do a Get-PowerCLIVersion).
I would suggest to upgrade if possible.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
If you need to stay with the older version, you could do
foreach($esx in Get-VMHost){
$esxcli = Get-EsxCli -VMHost $esx
$esxcli.network.ip.route.ipv4.list() |
select @{N='VMHost';E={$esx.Name}},*
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
yes, that was it, thank you!!!!