Community discussions

MikroTik App
 
mfrayyan
just joined
Topic Author
Posts: 12
Joined: Wed Mar 16, 2022 12:50 pm

Export / import users problem

Wed May 11, 2022 10:38 am

I have more than 14000 hotspot users and want to export, can't make export throw this code ((ip hotspot user export)
because it too large.

And searched another code : ((/ip hotspot user export file=users_and_profiles)) this code make file : users_and_profiles.rsc and can't import when try to import it with this code : ((/ip hotspot user import file=users_and_profiles)) this error appears: bad command name import (line 1 column 18)

what is the command to add the hotspot users from name.rsc that is created from "export file=name"?
 
erlinden
Forum Guru
Forum Guru
Posts: 1920
Joined: Wed Jun 12, 2013 1:59 pm
Location: Netherlands

Re: Export / import users problem

Wed May 11, 2022 10:55 am

I think any import should be done with: import file=[filename]

But looking into the file will give you a hint.
 
mfrayyan
just joined
Topic Author
Posts: 12
Joined: Wed Mar 16, 2022 12:50 pm

Re: Export / import users problem

Wed May 11, 2022 11:21 am

I think any import should be done with: import file=[filename]

But looking into the file will give you a hint.
thanks, but not working
[can't failure: user profile with such name already exists]
 
erlinden
Forum Guru
Forum Guru
Posts: 1920
Joined: Wed Jun 12, 2013 1:59 pm
Location: Netherlands

Re: Export / import users problem

Wed May 11, 2022 11:25 am

Lol...gladly you post the error message. Makes no sense to (re)import existing users...does it?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Export / import users problem  [SOLVED]

Wed May 11, 2022 11:38 am

user export file=users_and_profiles
users and profiles?
exporting only user section do not export also profiles...
exporting .rsc file (full with also profile templates) do not reassign the profile to single user, must be done manually...
There is no way to reassign profile that user have only by "export" and "import" functions

[...] user profile with such name already exists [...]
user profile???
is one user than already exist...
or a "user profile" with same name than already exist?...


If you want expor user, export the database, (/tool user-manager database save) and re-import the database on new machine (/tool user-manager database load) .

If you want add user to another machine, but on the other machine one profile or one user already exist, you give error.

The soluction is open with something the .rsc file and copy & paste on terminal, every 600 lines (no more...) until you paste all. (In your case, near 24 times)
On terminal, if the user creation fail because is already present, the terminal continue with next without errors.

But with .rsc you still need to re-assign manually the profile to ALL user.
At least, if you are not able to program some script on your own,
you can assign one profile to all new imported users with
"/tool user-manager user create-and-activate-profile [find] profile=<PROFILE NAME>"
but this apply also the profile to ALSO ON ALL USER ALREADY PRESENT ON DATABASE
 
mfrayyan
just joined
Topic Author
Posts: 12
Joined: Wed Mar 16, 2022 12:50 pm

Re: Export / import users problem

Wed May 11, 2022 12:24 pm

thanks @rextended
and thanks @rextended and nice to meet you again

note : the users hotspot not user manager

What I understand from your words its very hard to import the .rsc file from machine to another machine?
The soluction is open with something the .rsc file and copy & paste on terminal, every 600 lines (no more...) until you paste all. (In your case, near 24 times)
On terminal, if the user creation fail because is already present, the terminal continue with next without errors.
I want to apply this solution, but how?

when writing this code [ip hotspot export] export all users and I can copy last 1000 line only
How do I specify 600 lines only, then next 600, so that?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Export / import users problem

Wed May 11, 2022 12:37 pm

Ok, hotspot user, I have misunderstanded with user-manager, but all still the same

Open the .rsc file with some text editor than have line numbers...
 
mfrayyan
just joined
Topic Author
Posts: 12
Joined: Wed Mar 16, 2022 12:50 pm

Re: Export / import users problem

Wed May 11, 2022 12:47 pm

special thanks to you rextended, You always give me the best solution :)

Who is online

Users browsing this forum: rogerioqueiroz and 26 guests