Forum Discussion

Philip_King_719's avatar
Philip_King_719
Icon for Nimbostratus rankNimbostratus
Jul 23, 2018

How to export VS destination using icontrol

I'm trying to list all virtual servers, their destination IP/port, the default pool, and any irules. I've started playing with Get- and can see the information on the screen, but it is not passing to the log file. Can someone help me tweak the script I've started?

$ic = Get-F5.iControl

$F5Nm=(Get-F5.SystemInformation).Hostname
$Log="c:\temp\$F5Nm.txt"
Set-Content $Log -Value "VIPName,VIP,Pool,irule" -Encoding unicode
$VIPs = $ic.LocalLBVirtualServer.get_list()
foreach ($VIP in $VIPs) {
    $Pl=$ic.LocalLBVirtualServer.get_default_pool_name($VIP)
    $Dst=$ic.LocalLBVirtualServer.get_destination($VIP)
    $irl=$ic.LocalLBVirtualServer.get_rule($VIP)
    Add-Content $Log -Value "$VIP,$Dst,$Pl,$irl" -Encoding unicode
    }

The destination and irule show up in the log as:

,iControl.CommonIPPortDefinition,,iControl.LocalLBVirtualServerVirtualServerRule[]

No RepliesBe the first to reply