Forum Discussion
Feb 12, 2008
There are a couple of issues with your code. First, you are passing a scalar string as the pool name ("CRISA"). That needs to be an array. Also, you are passing a scalar for the IPPortDefinition structure parameter, which needs to be a 2-D array.
This should work for you:
$IP = New-Object -TypeName iControl.CommonIPPortDefinition
$IP.address = "1.1.1.1"
$IP.port = 9090
Create single 1-d array with IPPortDefinition
[iControl.CommonIPPortDefinition[]] $ipdefs = @($IP);
first parameter is a 1-d array with the pool names
second parameter is a 2-d array (array of arrays) with members
for each pool in the first dimension of the array.
$pmstat = $ic.LocalLBPoolMember(
(,"CRISA"),
(,$ipdefs)
);
The way I've been told to coerce a value into an array is to surround it by parenthesis and then delimit the values with commas. For only a single value, prefix the first value with the comma as I've done above.
Let me know if this works for you...
-Joe