For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Zdenda's avatar
Zdenda
Icon for Cirrus rankCirrus
Oct 21, 2013

Show members of Datagroup - PowerShell

Hi, I can't find the way to display members of Address datagroup. I am trying command like this:

$Class = (Get-F5.iControl).LocalLBClass
$Class.get_address_class_member($Class.get_address_class((,$DataGroup)))  

But it seems that get_address_class_member doesn't exists. Is there any similar command to show members of Datagroup? Thanks, Zdenek

3 Replies

  • LocalLB.Class.get_address_class_member isn't a method in the API. Where did you find a reference to it? The call to get_address_class will return an array of structures containing the name and members for each class requested. Here's some code to get you started

     

    $addressClassA = (Get-F5.iControl).LocalLBClass.get_address_class_list();
    $ClassInfoA = (Get-F5.iControl).LocalLBClass.get_address_class($addressClassA);
    foreach($class in $ClassInfoA) {
      $name = $class.name;
      Write-Host "Class: $name";
      $members = $class.members;
      foreach($member in $members) {
        Write-Host "  $member";
      }
    }

    Hope this helps...

     

  • Hi, do you know why this code returns only "iControl.LocalLBClassAddressEntry.address" when I use write-host for printing the IPs in datagroup?

     

    When I use only $member or for example $member.adderss I get the value in datagroup. I can't figure out why it is so.. thanks, Zdenek

     

  • I tuned the code a bit and this one shows the expected results, finally :-):-)

     

    $DataGroup = "my_group"
    $ClassInfo = (Get-F5.iControl).LocalLBClass.get_address_class($DataGroup);
    $name = $ClassInfo[0].name;
    Write-Host "Class: $name";
    $members = $ClassInfo[0].members
        foreach($member in $members) {
            $a = $member.address
            Write-Host "  $a";
        }