MAC TELNET foreach client in RB433 in AP bridge mode

Hi,

I’m new on Mikrotik teachnology and I want to make an script to change some parameters for each client in AP Routerboard.

I think the only way is to create an script to run it on the AP an enter for each client by MAC TELNET.

To do that iI create the following:

#Enter to each AP client by mac-telnet
:foreach i in=[/interface wireless registration-number ] do={ /tool mac-telnet [/interface wireless registration-table get $i mac-address]

#Enter login credentials

:put “user\r”
:put “password\r”

#change the scan list of the client
:put “interface wireless set scan-list= 5120,5210\r”

#close mac-telnet session
:put “quit”
}

For now it doesn´t work, for this reason I will appreciate very much some help with that.

Thanks!