Forum Discussion
Photo_G_84660
Nimbostratus
Mar 21, 2007"Unable to cast object of type 'System.Object[]' to type 'iControl.LocalLBPoolMemberMemberSessionState[][]'."
Hi,
I'm trying to code a method to disable pool members in VB .NET (using the new iControl.dll, THANKS JOE!!!), and it appears (in the debugger) to properly present the [pool_names] string ...
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
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
