Переписал скрипт. В таком виде все работает
/ip dhcp-server lease {
:foreach i in=[find (active-server=SSID && status="bound")] do={
:local hostname [get $i host-name]
:local vendor [:toarray "droid,hone,edmi,amsung,alaxy,eizu,UAWEI,EIZU"]
:foreach n in=$vendor do={
:if ($hostname~"$n") do={
:local mac [get $i active-mac-address]
:local macm ([:pick $mac 0 12] . "00:00");
:if ([/caps-man access-list find where mac-address=$macm]="") do={
/caps-man access-list add mac-address=$macm mac-address-mask=FF:FF:FF:FF:00:00 ssid-regexp=SSID action=reject place-before=0 comment=$hostname
:log info "Block $hostname"
}
/ip dhcp-server lease remove $i
:log info "Deleted from DHCP $hostname $mac"
}
}
}
}