Hi, i have this problem.
In which i have to change the password for more than 100 user in the user-manager user.
Let’s say here’s the list of my user
user101
user102
user103
user105
user107
.
.
.
user357
in which among the list there was some number that wasn’t there, like user 113, 115, 213.
Until this day, i change the password manually, but since i’ve want to make use the script function so it change by itself on weekly basis as the script running.
But i’ve met a trouble since i cann’t found the “*” or “%” (prefix) to make the script do checking the user first, if the user was there so the system change the password.
here’s the code that i’ve try to check the user first, i haven’t make the script to change the password.
#script change passwd user hotspot
:local Flag
:set Flag [/tool user-manager user find name="user???"] [color=#FF0000]<<<< i want to change ??? to symbol like % or * so it's automatically detect all the user[/color]
:if ([:len $Flag] > 0) do={/tool user-manager user append file uwifilog;}
for the above code, i make file uwifilog as the output for the user that was found by the script.
or should i change the script into this
#script remove log userman
:foreach i in=[/tool user-manager user find name="user???"] do
{
/tool user-manager user append file uwifilog;
}
as for the password, i usually change the “keyword” that followed by number like on the user
say for the
name = “user101”
password = “keyword101”
name = “user102”
password = “keyword102”
no change for the number, for user351, the password is keyword351.
Only keyword changed, like volcano, so the password is volcano351 for user351
and so on for the other user.
i want to make the script look like this:
:foreach i in=
:local currentPassword [/tool user-manager user get [/tool user-manager user find name="user.$i"] password];
:local number [:tonum [:pick $currentPassword 8 10]];
:set newPassword ("sea" . $number);
do
{
/tool user-manager set [/tool user-manager user find name="user.$i"] password = "$newpassword";
}
:until $i = 400
:break
could anyone help me on this problem
NB:
to change value that draw from the system like
:local number [:tonum [:pick $currentPassword 8 10]];
into number we use :tonum to change the value into numeric
what about changing the value into string, would it be like
#:local keyword [:tostr [:pick $currentPassword 1 7]]; <<< is this right?