Forum Discussion

paul_dawson_258's avatar
paul_dawson_258
Icon for Nimbostratus rankNimbostratus
Aug 02, 2016

Powershell query for SSL Client profile

Hi,

I would like to use powershell iControl snapin to query all Virtual Servers and list the ones that have an SSL client profile.

I have tried:

$ProfileSSL = (Get-F5.iControl).LocalLBVirtualServer.ProfileClientSSL

and

$ProfileSSL = (Get-F5.iControl).ProfileClientSSL

What am I missing?

Thanks,

Paul

3 Replies

  • I believe you'll need to pass the virtual server name to the get_profile() method. Something like this:

    $vips = (Get-F5.iControl).LocalLBVirtualServer.get_list()
    ForEach ($vip in $vips){
        $profiles = (Get-F5.iControl).LocalLBVirtualServer.get_profile($vip)
        If ($profiles){
            write-output "Virtual Server: $Vip"
            Write-Output "Profiles: `r`n " + $profiles
        }
        Write-Output "-----"
    }
    
  • Hi Joel,

     

    I tried to set the context to Client SSL profile. But, it doesn't seem to work. Could you please take a look at the below code once?:

     

    If ($profiles){
        $profile1 = New-Object -TypeName iControl.LocalLBVirtualServerVirtualServerProfile
        $profile1.profile_context = "PROFILE_CONTEXT_TYPE_CLIENT"
        $profile1.profile_name = $vip
        (Get-F5.iControl).LocalLBVirtualServer.get_profile($profile1.profile_name)
        write-output "Virtual Server: $Vip"
        Write-Output "Profiles: `r`n " + $profiles
    } 
    • Joel_Newton_449's avatar
      Joel_Newton_449
      Icon for Cirrus rankCirrus

      Hi, Jalees, I actually haven't used the iControl COM object in years. Are you getting a specific error with your attempts, or does it just fail silently?

       

      I exclusively use iControlREST to automate anything related to the F5. I've created a PowerShell module to do this: https://github.com/joel74/POSH-LTM-Rest