I’m trying to write a script that will create a hotspot user based on the unauthorized dynamic hosts in the hotspot. This is a one time script that we will use to quickly turn up a hotspot device and then we will apply proper queuing after the fact.
Because we are using MAC authentication, I’m trying to get the mac-address of the host and make a user based on that MAC address with a specific policy.
When I do /ip hostspot host get 0 mac-address
It returns nothing in the CLI.
Any suggestions?
/ip hostspot host get 0 mac-address
wrong syntax (and hostspot must be hotspot)
:put [/ip hotspot host get 0 value-name=mac-address;]
but is only visible on terminal,
if you want use this on script:
:foreach tmpHost in=[/ip hotspot host find] do={
:local hostMAC value=[/ip hotspot host get $tmpHost value-name=mac-address];
# put other instructions here.... the MAC address are inside $hostMAC variable;
}
This worked wonderfully, thank you very much.
:foreach tmpHost in=[/ip hotspot host find where !authorized] do={
:local hostMAC value=[/ip hotspot host get $tmpHost value-name=mac-address];
/ip hotspot user add name=$hostMAC profile=5/5;
/ip hotspot host remove $tmpHost;
}
I suggest you to add:
/ip hotspot user add name=$hostMAC profile=5/5 disabled=no;
Well,
If I helped you, please add Karma, thanks 