Community discussions

MikroTik App
 
adminradi
just joined
Topic Author
Posts: 1
Joined: Thu Oct 26, 2017 12:26 pm

API MIkrotik

Thu Oct 26, 2017 12:45 pm

hello, i have probblem
how to remove actual profile use php api mikrotik. i have profile success to create and active profile for user in usermanager
but i not remove active profile..
tank's you for answer
How to script remove actual profile with php api mikrotik
Screenshot_31.png
You do not have the required permissions to view the files attached to this post.
 
User avatar
ahmedalmi
Frequent Visitor
Frequent Visitor
Posts: 75
Joined: Sat Sep 13, 2014 5:52 pm
Location: sana'a yemen
Contact:

Re: API MIkrotik

Tue Oct 31, 2017 1:30 am

there is no script to do this . just by user manager web
but you can remove the user then add new with your new profile
 
User avatar
ADahi
Member Candidate
Member Candidate
Posts: 209
Joined: Thu Sep 21, 2017 7:16 pm
Location: Iraq, Ninavah
Contact:

Re: API MIkrotik

Tue Dec 05, 2017 8:25 am

via Script/CLI
suppose username is "111"
suppose profile is TRIAL

To remove user profiles try this
/tool user-manager user clear-profiles numbers=[find username="111"]; 


To add profile to user try this
/tool user-manager user create-and-activate-profile profile=TRIAL customer=admin numbers=[find username="111"]; 


Best Regards
 
User avatar
sirdash
just joined
Posts: 2
Joined: Sat Nov 05, 2011 8:14 am
Location: Azarbaican

Re: API MIkrotik

Sat Aug 03, 2019 12:26 am

via Script/CLI
suppose username is "111"
suppose profile is TRIAL

To remove user profiles try this
/tool user-manager user clear-profiles numbers=[find username="111"]; 


To add profile to user try this
/tool user-manager user create-and-activate-profile profile=TRIAL customer=admin numbers=[find username="111"]; 


Best Regards
hello
this work for me
but a question
i have 3 profile but i can active a profile for user . why?
 
yalozair
just joined
Posts: 1
Joined: Wed Oct 09, 2019 1:24 pm

Re: API MIkrotik

Wed Oct 09, 2019 2:02 pm

where is the problem
MK mikrotik = new MK(textBox1.Text, Convert.ToInt16(textBox8.Text));
if (mikrotik.Login(admin, password))
{

mikrotik.Send("/tool/user-manager/profile/print", true);

mikrotik.Send("=.username=name=");
mikrotik.Send("=.proplist=owner=");
mikrotik.Send("=.proplist=name-for-users=");
mikrotik.Send("=.proplist=validity=");
mikrotik.Send("=.proplist=starts-at=");
mikrotik.Send("=.proplist=price=");
mikrotik.Send("=.proplist=override-shared-users=");

mikrotik.Send(".tag=/tool",true);
string result = Convert.ToString(mikrotik.Read());
comboBox1.Items.Clear();

int a1,a2,a3,a4,a5,a6,a7;
foreach (string h in mikrotik.Read())
{

a1 = h.IndexOf("=name=");
a2 = h.IndexOf("=owner=");
a3 = h.IndexOf("=name-for-users=");
a4 = h.IndexOf("=validity=");
a5 = h.IndexOf("=starts-at=");
a6 = h.IndexOf("=price=");
a7 = h.IndexOf("=override-shared-users=");


if (a1 > 0 && a2>0 && a3>0 && a4>0 && a5>0 && a6>0 &&a7>0 )
{
comboBox1.Items.Add(h.Substring(a1));
}


}
}

Who is online

Users browsing this forum: No registered users and 7 guests