Forum Discussion
kelemvor_50002
Nimbostratus
Jul 12, 2013Can I change the default pool for a virt?
Can I make changes to a virt via Powershell? If I have Virt_1 pointing to Pool_1 and I want it to point to Pool_2, can I do that?
7 Replies
- mikeshimkus_111Historic F5 AccountHi kelemvor, you cannot change the BIG-IP configuration using Powershell.
thanks,
Mike - Kevin_Stewart
Employee
You can actually.
https://devcentral.f5.com/wiki/iControl.PowerShell.ashx
At a minimum you need the following commands:Add-PSSnapin iControlSnapin Initialize-F5.iControl -HostName [IP of host name of BIG-IP] -Username [admin username] -Password [admin password] $changepool = (Get-F5.iControl).LocalLBVirtualServer.set_default_pool_name(("my_vs"), ("my_new_pool")) - kelemvor_50002
Nimbostratus
Sweet! That worked great.
Thanks!
- kelemvor_50002
Nimbostratus
One other question. Can I work that into a Try/Catch statement?
I tried adding my standard -ea stop -ev error to the end of the get-f5 line but it didn't seem to like that very much.
Thanks again.
- Kevin_Stewart
Employee
$success = Initialize-F5.iControl -HostName 192.168.1.245 -Username admin -Password password Try { $(Get-F5.iControl).LocalLBVirtualServer.set_default_pool_name(("access-test-vs"), ("local-pool-single1")); } Catch { Write-Host "Caught an error" } - kelemvor_50002
Nimbostratus
Posted By Kevin Stewart on 07/16/2013 03:54 PM
Oh OK. I would always add -ea stop -ev errorvar to the end so the error it finds gets put in the variable and I can then use it to display to the user or log to a file. Does this jsut dump the error to the screen if it finds one or does it not show the actual error at all and just shows what you write-host to the screen?$success = Initialize-F5.iControl -HostName 192.168.1.245 -Username admin -Password password Try { $(Get-F5.iControl).LocalLBVirtualServer.set_default_pool_name(("access-test-vs"), ("local-pool-single1")); } Catch { Write-Host "Caught an error" } - Kevin_Stewart
Employee
Not able to test now, but pretty sure this works:Write-Host $_.Exception.Message
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects