Community discussions

MikroTik App
 
gtpro
newbie
Topic Author
Posts: 36
Joined: Thu Jun 03, 2010 9:05 pm

Script fails on 6.34, works on 6.28

Mon Mar 20, 2017 9:31 pm

Hello, I am using the following script on 6.28:

:foreach i in=[/tool user-manager user find] do={:if ([/tool user-manager user get $i uptime-used]= 1h) do={
:log warning ("Delete user... $[/tool user-manager user get $i name]")
/tool user-manager user remove [/tool user-manager user get $i name]
}
}

But this same script does not work on 6.34.1

Any one know how to fix it for 6.34.1?. Thanks.
 
gtpro
newbie
Topic Author
Posts: 36
Joined: Thu Jun 03, 2010 9:05 pm

Re: Script fails on 6.34, works on 6.28

Mon Mar 20, 2017 11:28 pm

Found the solution!

:foreach i in=[/tool user-manager user find] do={:if ([/tool user-manager user get $i uptime-used]=1h) do={
:log warning ("Delete user... $[/tool user-manager user get $i user]")
/tool user-manager user remove [/tool user-manager user get $i user]
}
}

So all I had to change was "name" to "user". I hope it helps others.
 
User avatar
HarBenly
newbie
Posts: 42
Joined: Wed Dec 07, 2016 1:04 pm
Location: London, United Kingdom

Re: Script fails on 6.34, works on 6.28

Tue Mar 21, 2017 1:46 pm

Thanks man! just the simple change and yes its working. This thread was very helpful
 
gtpro
newbie
Topic Author
Posts: 36
Joined: Thu Jun 03, 2010 9:05 pm

Re: Script fails on 6.34, works on 6.28

Wed Mar 22, 2017 1:44 am

Good!

Who is online

Users browsing this forum: No registered users and 15 guests