Forum Discussion

Scott_Jarboe_31's avatar
Scott_Jarboe_31
Icon for Nimbostratus rankNimbostratus
Aug 07, 2017

PowerShell: Duplicate Virtual Server with destination changed

Afternoon,

 

I'm a PowerShell person looking to do some work on our F5. Specifically, we are being forced to change our public IP's due to a change by our hosting provider. What I want to do is duplicate all of our existing Virtual Servers 100% (same iRules, http classes, EVERYTHING), save change their names and destinations. Preferably with PowerShell as I don't work with much else. I'm familiar with the POSHLTM module but am not certain if this captures all the data necessary to duplicate virtuals. Any guidance would be appreciated! I did see this question asked before, but the thread I saw was from 2012 and I imagine there may be new information since then.

 

Regards, SJ

 

1 Reply

  • If you just want to change the destination IP address of a virtual, you can use curl from DOS prompt. The example below modifies the destination IP address of the virtual "vs" to 10.0.0.1:80.

    curl -sku admin: https://192.168.0.1/mgmt/tm/ltm/virtual/vs -X PATCH -H "Content-type: application/json" -d "{\"destination\":\"10.0.0.1:80\"}"

    where 192.168.0.1 is the BIG-IP's management port IP adddress. This is equivalent to

    tmsh modify ltm virtual vs destination 10.0.0.1:80
    .

    If you want to do the same for multiple virutals, you can use

    for
    (dos command). e.g.,
    for %vs in (vs1 vs2 vs3) do curl .....
    .

    See Download page for the windows version curl.