Forum Discussion

Jeff_Brinkerho1's avatar
Jeff_Brinkerho1
Icon for Nimbostratus rankNimbostratus
Sep 08, 2016

Powershell iControl Snapin - DISconnecting from one LTM, connecting to another - same script

We have a need to populate an address datagroup from an external database. I currently have a working proof of concept in powershell using the F5 supplied iControl snapin. Works great.

However, we have a pair of LTM4000's - running active/standby. I want to cover the case where a standby swap has happened and the active is now standby.

I have noticed that when I connect to the LTM using

Initialize-F5.iControl
that I cannot "disconnect", and that if I try to connec to to the second LTM using a second statement (with a different hostname), that all subsequent commands pull information from the FIRST connected LTM.

For example,

(Get-F5.iControl).ManagementDBVariable.query("hostname")
will show the hostname of the first one I initialize no matter what.

I'm new to powershell, and I must be missing something here. If anyone can lend a hand - the problem I'm trying to solve is:

Connect to both LTM's, and determine which is active Connect to only that LTM and perform our manipulation of the address data group.

Each loop through I would check and connect to only the active. Probably would also be nice to check the sync state, just in case it winds up in an inconsistent state I can abort/error. I suspect that perhaps I need to set a hostname value for each icontrol command to tell it where to go?

Thanks in advance

1 Reply

No RepliesBe the first to reply