Forum Discussion

BenConrad_10265's avatar
BenConrad_10265
Icon for Nimbostratus rankNimbostratus
May 04, 2011

How to disconnect iControl session?

Hello,

 

 

I'm starting to write scripts with the iControl snapin. I understand that I can connect with Initialize-F5.iControl but how do I disconnect my session? Closing out of the PowerShell shell is not what I had in mind as a resolution.

 

 

Thanks,

 

 

Ben

 

1 Reply

  • Hi Ben, the "session" you are creating just sets a local variable in the current iControl.Interfaces object (returned from Get-F5.iControl). Each request to the server is a distinct HTTP connection with separate authentication involved.

    This is the first request I've had to clear out the client credentials on the default interfaces object.

    If you really want to create a temporary object and be able to clear it out of the existing session, you'll have to bypass the Cmdlets and use the native iControl library that is exposed with the Get-F5.iControl cmdlet. If that's the case then you can just use the New-Object cmdlet instead of Initialize-F5.iControl to create it and then set it to $null when you are done.

    $ic = New-Object iControl.Interfaces
    $ic.initialize("hostname", "username", "password");
    ...
    $ic = $null

    Hope this helps...