# Create LTM Pool Members

**URL:** <https://community.f5.com/t/create-ltm-pool-members/64772>\
**Category:** Community CodeShare\
**Tags:** tmsh, application-delivery, ltm\
**Created:** [March 10, 2015, 7:02pm UTC](https://community.f5.com/t/create-ltm-pool-members/64772 "2015-03-10T19:02:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CodeCentral\_194](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@CodeCentral\_194](https://community.f5.com/u/CodeCentral_194)\
**Post date:** [March 10, 2015, 7:02pm UTC](https://community.f5.com/t/create-ltm-pool-members/64772/1 "2015-03-10T19:02:42Z")

</div>

**Problem this snippet solves:**

This example shows how to automate pool member creation with tmsh scripting.

**Code :**

```auto
modify script create_pool.tcl {

proc script::help { } {
    tmsh::add_help "Create a pool with contiguous member addresses\n\
        <pool name=""> <first member=""> <count>"
}

proc script::run { } {

    if { $tmsh::argc < 4 } {
        puts "Requires three arguments: <pool name=""> <first member=""> <count>"
        exit
    } else {
        set poolname [lindex $tmsh::argv 1]
        set start [lindex $tmsh::argv 2]
        set total [lindex $tmsh::argv 3]
    }
    scan $start "%d.%d.%d.%d:%d" a b c d p
    set members ""
    for {set x 0} {$x < $total} {incr x} {
        set members "$members $a.$b.$c.$d:$p"
        incr d
        if { $d > 255 } {
            set d 0
            incr c
            if { $c > 255 } {
                set c 0
                incr b
                if { $b > 255 } {
                    set b 0
                    incr a
                }
            }
        }
    }
    tmsh::create /ltm pool $poolname members add \{ $members \}
}

}</count></first></pool></count></first></pool>

```

---

<div class="post-metadata">

**Author:** ![Prakash\_Jayaram](https://avatars.discourse-cdn.com/v4/letter/p/5e9695/32.png) [@Prakash\_Jayaram](https://community.f5.com/u/Prakash_Jayaram)\
**Post date:** [December 5, 2017, 12:01pm UTC](https://community.f5.com/t/create-ltm-pool-members/64772/2 "2017-12-05T12:01:16Z")

</div>

May be the first line should be “create cli script create\_pool.tcl”, which will prompt with editor, add the sections “proc script::run” and “proc script::help” accordingly. And to run the script (tmos)run cli script /Common/create\_pool.tcl
