PowerCLI

 View Only
  • 1.  Get ESXi routing table powerCli

    Posted Oct 24, 2017 10:10 AM

    Hi,

    I want to ask is it a way how to get ESXi routing table via powerCLI from various (69) ESXi host?

    thanks



  • 2.  RE: Get ESXi routing table powerCli

    Posted Oct 24, 2017 10:34 AM

    Does this bring what you want?

    $esxcli = Get-EsxCli -VMHost MyEsx -V2

    $esxcli.network.ip.route.ipv4.list.Invoke()



  • 3.  RE: Get ESXi routing table powerCli

    Posted Oct 24, 2017 10:37 AM

    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}},*

    }



  • 4.  RE: Get ESXi routing table powerCli

    Posted Oct 24, 2017 11:24 AM

    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



  • 5.  RE: Get ESXi routing table powerCli

    Posted Oct 24, 2017 12:18 PM

    Does Get-VMHost return anything?
    Are you connected to the vCenter?



  • 6.  RE: Get ESXi routing table powerCli

    Posted Oct 24, 2017 12:46 PM

    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



  • 7.  RE: Get ESXi routing table powerCli

    Posted Oct 24, 2017 12:54 PM

    Looks like you are on an older PowerCLI version (do a Get-PowerCLIVersion).

    I would suggest to upgrade if possible.



  • 8.  RE: Get ESXi routing table powerCli
    Best Answer

    Posted Oct 24, 2017 12:55 PM

    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}},*

    }



  • 9.  RE: Get ESXi routing table powerCli

    Posted Oct 24, 2017 01:01 PM

    yes, that was it, thank you!!!!