Forum Discussion
Richard_Brookfi
Nov 13, 2010Nimbostratus
multiple instances of PS not working
hello there. First I would like to say thank you for building such a useful tool. I have run in to a couple of issues though and would love to know if there is something i am doing wrong. Here is my d...
Nov 30, 2010
Richard, sorry for the delayed response, for some reason I missed this post in my notification list in my email.
The iControl Snapin uses a single internal connection instance. If you are using it within the same runspace, there is only a single internal iControl.Interfaces object. So, if you call Initialize-F5.iControl multiple times it will just overwrite the internal Interfaces object.
Now, that doesn't mean you can't use multiple connections from within PowerShell. It just means you can't do it with the Initialize-F5.iControl cmdlet.
What I would do would be to instantiate multiple instances of iControl.Interfaces objects and then call the local "initialize()" method on each of them. Then use those interface objects for your two connections. Something like this:
$iControl1 = New-Object -TypeName iControl.Interfaces
$iControl1.initialize("bigip1", "bigip1_user", "bigip1_pass");
$iControl2 = New-Object -TypeName iControl.Interfaces
$iControl2.initialize("bigip2", "bigip2_user", "bigip2"pass");
$bigip1_pool_list = $iControl1.LocalLBPool.get_list();
$bigip2_pool_list = $iControl2.LocalLBPool.get_list();
Note that now you wouldn't be using the Get-F5.iControl cmdlet (which essentially returns the internal iControl.Interfaces object). You would be creating the object yourself and then referencing it locally.
Hope this helps...
-Joe
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