Forum Discussion
Michael_Jenkins
Mar 11, 2015Cirrostratus
I don't know of any documentation that describes the Powershell implementation the way you're asking, but I can try to answer your questions.
First, the only documentation I know of would be the download page and then the iControl PowerShell page.
When you do
Initialize-F5.iControl
, it sets up the information for a connection to the specified device. If you call it subsequent times, it will overwrite the existing connection information.
Then, when you make a call like
$iControl = Get-F5.iControl
it will be based on the connection you just initialized. (Note that if you run the initialize command again after calling the Get-F5.iControl function, your object will be updated to point to the new device. So you wouldn't be able to have multiple different $iControl
instances going to different devices.
Regarding the way authentication works on each call, PowerShell will send the credentials in a header as the service uses Basic authentication to validate the user. So each command is essentially independent of any others, and will always send the authorization header for each request.
So basically, if you have multiple devices you want to interact with (as your script does), the
Initialize-F5.iControl
command will keep updating with the specified hostname instead of creating additional connection objects. Then the subsequent commands in your loop will be scoped to that device.
Hope this helps.