Forum Discussion

Snehasish's avatar
Icon for Nimbostratus rankNimbostratus
Apr 18, 2024

Get associated pool name from VIP IP using F5-LTM

I am trying to get the pool name from the VIP IP which I am getting from a input file, but I am unable to get any cmdlet related to that

$secpasswd = ConvertTo-SecureString "" -AsPlainText -Force

$MyLTM_IP = ""
$mycreds = New-Object System.Management.Automation.PSCredential "rk", $secpasswd
$session = $null
#Create an F5 session
$session = New-F5Session -LTMName $MyLTM_IP -LTMCredentials $mycreds -PassThru

$get_data = Import-Csv -Path "D:\f5\IP_Addition_Input.csv"
$VIP_IP = $get_data.VIPIP

Please let me know how can I get the pool name. going forward I have a add nodes to that pool.

I am using `F5-LTM` module

# Download latest version
$webclient = New-Object System.Net.WebClient
$url = ""
Write-Host "Downloading latest version of F5-LTM from $url" -ForegroundColor Cyan
$file = "$($env:TEMP)\"
Write-Host "File saved to $file" -ForegroundColor Green

# Unblock and decompress
Unblock-File -Path $file
$targetondisk = "$($env:USERPROFILE)\Documents\WindowsPowerShell\Modules"
# no need to handle, this folder should just exist
New-Item -ItemType Directory -Force -Path $targetondisk -ErrorAction SilentlyContinue | out-null

# Unzip 
Write-Host "Uncompressing the Zip file to $($targetondisk)" -ForegroundColor Cyan
$shell_app=new-object -com shell.application
$zip_file = $shell_app.namespace($file)
$destination = $shell_app.namespace($targetondisk)
$destination.Copyhere($zip_file.items(), 0x10)

# Rename and import
Write-Host "Renaming folder" -ForegroundColor Cyan

if (Test-Path ($targetondisk+"\F5-LTM")) {
    Write-Host "Removing prior $($targetondisk+"\F5-LTM") folder" -ForegroundColor Yellow
    Remove-Item -Recurse -Force -Path ($targetondisk+"\F5-LTM")  | out-null    
Move-Item -Path ($targetondisk+"\POSH-LTM-Rest-master") -Destination "$($targetondisk+"\F5-LTM")" -Force  | out-null   

Write-Host "Module has been installed" -ForegroundColor Green
Import-Module -Name "$($targetondisk+"\F5-LTM\F5-LTM")" # Zip file has a sub F5-LTM folder with the module
Get-Command -Module F5-LTM

No RepliesBe the first to reply