Community discussions

MikroTik App
 
Alqatife
just joined
Topic Author
Posts: 14
Joined: Wed Jun 02, 2010 3:40 pm

expired User Automatically change profile

Tue Mar 13, 2012 4:39 pm

Hi,

I'm trying to write a script to find expire user in user manager and automatically change profile to another profile (expire):


:local varDate
:local varMonth
:local varDay
:local varYear
:local varlastseen
:local varlastseenmonth
:local varcredit
:local user
:set varDate [/system clock get date];
:set varMonth [:pick $varDate 0 3];




/tool user-manager user
:foreach i in=[ /tool user-manager user find subscriber=hs_admin ] do={
:set varlastseen [get $i last-seen]
:set varcredit [get $i credit-left]
:set user [get $i name]
:set varlastseenmonth [:pick $varlastseen 0 3];
:if ([$varcredit] = 00:00:00) do={
:if ([$varlastseenmonth] != [$varMonth] ) do={
/tool user-manager user create-and-activate-profile user=$i profile=expire customer=admin
}
}
}

How to make this script working with user manager v5.X

Who is online

Users browsing this forum: JDF and 28 guests