Forum Discussion

naydencho_66052's avatar
Icon for Nimbostratus rankNimbostratus
Dec 13, 2011

Adding a pool member syntax


I am trying to add a node to a pool (with PowerShell) using the following syntax:




(Get-F5.iControl).LocalLBPool.add_member("pool_test", "")




The error I get is


Cannot convert argument "1", with value: "", for "add_member" to type "iControl.CommonIPPortDefinition[][]"


: "Cannot convert the "" value of type "System.String" to type "iControl.CommonIPPortDefinition[][]"."


At line:1 char:41


+ (Get-F5.iControl).LocalLBPool.add_member <<<< ("pool_test", "")


+ CategoryInfo : NotSpecified: (:) [], MethodException


+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument







What is the correct syntax for the second parameter? I can't seem to find it in the forums, wiki, API documentation... :(




Thanks in advance!




3 Replies

  • In your code, you are just passing in a scalar string for both the pool_name and members parameters. The definition for the function is:

    add_member (

    String [] pool_names,

    Common__IPPortDefinition [][] members


    The first parameter is an array of strings, one for each pool you want to add members to. The second parameters is a 2-d array, with each dimension for the list of members you want to add to the given pools in the first parameter.

    I'm not at my desk right now, so I don't have an exact code snippet for that function in PowerShell, but I did put this up in the codeshare a while ago where it uses the PoolMember.get_statistics() method

    Look down in the Disable-Member function for the call to get_statistics. In that call, I pass in a single pool in the pool_name variable, and a single member for the second param. The return value isn't the same for the two methods, but it should show you how to declare the proper types for the parameters and how to fill them in.

    Hope this helps...


  • That was perfect, thank you! The code is basically the same, I just did not realize I have to create the iControl.CommonIPPortDefinition objects... :) n00b :)



    Thanks again!