delete all users usermanager

Hi,
I need to make a routine in .net to synchronize our user’s table with the users into user manager.

I think one solution is delete all the users from user manager and after insert one by one.

What do you think?

It’s possible to send one command from .net to delete all the records?

Is there another kind of solution?

Thank you and excuse my english

That would probably be the easiest as long as you don’t need to keep any of the existing usermanager users.

I don’t know about .net, but you can delete all users from the router by running this command in the console:

/tool user-manager user remove [find]



Does this need to continue to be synchronized as users are added/removed from .net db? Or do you only need to do this synchronization only one time?

If it’s only one time, I would export an excel or text file list of all the users from .net, and then edit the file using find/replace to get it into the format of:

/tool user-manager user add name=userName customer=admin etc...

Then, you can copy/paste the code directly into the router and add the users.

Hi, I need to synchronize the tables periodically , maybe every day.
The code I’m triying to delete all the users is:
mk.Send(“/tool/user-manager/user/remove [find]”, False)
mk.Send(“=customer=admin”, True)
and the response from mikrotik is
!trap=message=no such command!


Any idea?

Thank you

With the API, you will need to get all items and then loop through and remove them. Something like this:
http://forum.mikrotik.com/t/how-to-remove-all-scheduler-tasks-in-terminal/42860/1 except this is in different API client.

This .net code looks like it loops through items, might be helpful:
http://forum.mikrotik.com/t/api-in-vb-net/72562/1

Hi, can you say me how convert the next command in .net code?

/tool user-manager user remove [find]

I not know how to use the query “[find]” into the vb .net code.

For example I try to send this code but it not works

mk.Send(“/tool/user-manager/user/remove”, False)
mk.Send(“=[find]=”, False)
mk.Send(“=customer=admin”, True)

Can you help me?

Thank you.