Forum Discussion

LanceLyons's avatar
Aug 01, 2022

Powershell New-F5Session and close session issues.

Hi,   We have some automation around some F5 functionality.  We have moved from 1 F5 to 2 F5s,  one for external apps and one for internal apps.   In our powershell automation we now have to create two different F5 sessions depending on which F5 we want to make changes in.  I have a snippet of the PS code below.

Is there any way to close the session that was opened and then create a new session?

We are finding the creating a New-F5session when one has already been created doesnt work and still uses the first session opened. 

Can I have 2 sessions and use the  Add-iRuleToVirtualServer   with some sessionID?



$ltmip = ""      
$ltmip_inside = ""            

         if ($vipName.ToLower() -contains "internal") {
             $session = New-F5Session -LTMName $ltmip_inside -LTMCredentials $mycreds
         } else {
             $session = New-F5Session -LTMName $ltmip -LTMCredentials $mycreds          

      $add = Add-iRuleToVirtualServer -InputObject $vipObject -iRuleName $all_MaintRule




9 Replies