Forum Discussion

Ken_B_50116's avatar
Ken_B_50116
Icon for Cirrostratus rankCirrostratus
Jun 23, 2016

How to use Get-F5.iControl to get the destination IP of virtual server?

I'm trying to use Get-F5.iControl in Powershell to fetch the destination IP address of a virtual server. I have the iControl Powershell module installed and I can query LTM successfully, for example:

(Get-F5.iControl).locallbpool.get_list();

...shows me a list of all pools.

I have seen the API documentation here, but I don't know enough to translate that knowledge into viable Powershell commands, such as getting details of a Virtual Server.

thanks!

2 Replies

  • Here's how you can get the destination addresses of all virtuals

    $VSList = (Get-F5.iControl).LocalLBVirtualServer.get_list();
    $AddressPortList = (Get-F5.iControl).LocalLBVirtualServer.get_destination_v2($VSList);
    for($i=0; $i -lt $AddressPortList.length; $i++) {
      $virtual = $VSList[$i];
      $vaddr = $AddressPortList[$i].address;
      $vport = $AddressPortList[$i].port;
      Write-Host "Virtual ${virtual} -> ${vaddr}:${vport}"
    }
    

    This was written without testing to I apologize in advance for any typos...

    For future reference, I've put together a lot of PowerShell articles and samples that are listed in the iControl Wiki at https://devcentral.f5.com/wiki/iControl.PowerShell.ashx

    Hope this helps!

    -Joe