Hi,
the following script works fine on terminal but it’s not working on “run script button” on winbox or with scheduler. the script is used to disable/enable some userman users at certain times.
:local p; :for i from=0 to=320 do={:set p [/tool user-manager user get $i actual-profile]; :if (p=“200MBN”||p=“500MBN”||p=“1GBN”) do={[/tool user-manager user set $i disabled=no]; log info “night user enabled successfully”}};
Numbers don’t work in scripts… At least in more recent versions. If you want to loop over items, it’s best that you use foreach, with a “find” command to get all IDs.
BTW, you could also use the “enable” command instead of setting disabled to no.
so:
:local p;
/tool user-manager user
:foreach i in=[find] do={
:set p [get $i actual-profile];
:if (p=“200MBN” || p=“500MBN” || p=“1GBN”) do={
enable $i;
/log info “night user enabled successfully”;
};
};