Forum Discussion
multiple instances of PS not working
I have application that manages connecting to all of our BigIP servers using multiple instances of PS (via activexposh)
here is a simple example of the concept using autoit:
Region ;**** Directives created by AutoIt3Wrapper_GUI ****
AutoIt3Wrapper_outfile=testing.exe
EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
include
include
include
include
Region START Koda GUI section Form=
Global $Form1 = GUICreate("Form1", 625, 440, 198, 55)
Global $Input1 = GUICtrlCreateInput("Input1", 0, 64, 121, 21)
Global $Input2 = GUICtrlCreateInput("Input2", 304, 64, 121, 21)
Global $Edit1 = GUICtrlCreateEdit("", 0, 120, 305, 233)
GUICtrlSetData(-1, "Edit1")
Global $Edit2 = GUICtrlCreateEdit("", 304, 120, 313, 233)
GUICtrlSetData(-1, "Edit2")
Global $Button1 = GUICtrlCreateButton("Button1", 160, 64, 75, 25, $WS_GROUP)
Global $Button2 = GUICtrlCreateButton("Button2", 464, 64, 75, 25, $WS_GROUP)
Global $OUTPUT_BUFFER = 2
Global $psObj = ObjCreate("SAPIEN.ActiveXPoSH")
Global $psObj2 = ObjCreate("SAPIEN.ActiveXPoSH")
Global $init1 = $psObj2.Init("True")
Global $init2 = $psObj.Init("True")
GUISetState(@SW_SHOW)
EndRegion END Koda GUI section
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $Button1
$cmd1 = GUICtrlRead($Input1)
$psObj.OutputMode = $OUTPUT_BUFFER
$psObj.Execute($cmd1)
GUICtrlSetData($Edit1, $psObj.outputstring)
$psObj.ClearOutput()
case $Button2
$cmd2 = GUICtrlRead($Input2)
$psObj2.OutputMode = 2
$psObj2.Execute($cmd2)
GUICtrlSetData($Edit2, $psObj2.outputstring)
$psObj2.ClearOutput()
EndSwitch
WEnd
So by looking at this you can see that i have 2 groups of a edit box and output window tied to a instance of power shell. Now if I take one set and change to 1 directory and I execute DIR and then execute DIR on the other group I come up with different results. I will show me one directory listing and the other will show me something completely different. However, If I use the icontrol snap-in and connect to one BigIP server with one group and then I connect to a different BigIP server with the other group and then run get-f5.ltmpool in each group. It will only display the results for the last BigIP server I logged into (for both) Its like even though I am using 2 independent instances of power shell the connection between the 2 (for BigIP) is shared... I have found that if I just open 2 power shell windows on my desktop the connections to BigIP servers are not shared. Is there something with your snap-in that references my application's (as a whole) instance? I have tried to figure out if the issue lies with the snap-in or if it is with the activexposh. But I tend to think this has something to do with the snap-in because I have been able to confirm that the instances of power shell are in fact independent but executing other commands not related to icontrol.
- Richard, sorry for the delayed response, for some reason I missed this post in my notification list in my email.
$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();
Recent Discussions
Related Content
* 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