Forum Discussion
How to use Get-F5.iControl to get the destination IP of virtual server?
I'm trying to use Get-F5.iControl in Powershell to fetch the destination IP address of a virtual server. I have the iControl Powershell module installed and I can query LTM successfully, for example:
(Get-F5.iControl).locallbpool.get_list();
...shows me a list of all pools.
I have seen the API documentation here, but I don't know enough to translate that knowledge into viable Powershell commands, such as getting details of a Virtual Server.
thanks!
2 Replies
- Vijay_E
Cirrus
Doesn't this give you information on obtaining VS related info: https://devcentral.f5.com/wiki/iControl.LocalLB.ashx ?
Here's how you can get the destination addresses of all virtuals
$VSList = (Get-F5.iControl).LocalLBVirtualServer.get_list(); $AddressPortList = (Get-F5.iControl).LocalLBVirtualServer.get_destination_v2($VSList); for($i=0; $i -lt $AddressPortList.length; $i++) { $virtual = $VSList[$i]; $vaddr = $AddressPortList[$i].address; $vport = $AddressPortList[$i].port; Write-Host "Virtual ${virtual} -> ${vaddr}:${vport}" }
This was written without testing to I apologize in advance for any typos...
For future reference, I've put together a lot of PowerShell articles and samples that are listed in the iControl Wiki at https://devcentral.f5.com/wiki/iControl.PowerShell.ashx
Hope this helps!
-Joe
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com