List all Users via Mattermost CLI

Hi Mattermost community !

First of all we are using Mattermost for years now so thanks for the hard work put into this great Project !

Now onto my question. I don’t know if it exists but i need a list of all users on our Mattermost Server piped into a file.
I know there is a way to do it with the API but since i am not a Programmer myself i thought maybe there is an easier way to get a list with all active users.

To be honest i am astound that the mattermost CLI can’t do that allready since it can list almost everything else.

Greetz
Vash

Hello, @Vash90!

When you mention that you would like to get the list of all active users besides the Get users API , the first thing that I can think of is to run the SELECT statement and pipe the output to a .txt file for example if you have access to the database. For example:

SELECT * FROM Users WHERE DeleteAt = 0 INTO OUTFILE "/tmp/users.txt";

:information_source: You can change the * to include only information that you need such as Username, Email, etc.

Else, can you explain a little bit better on the ideal way of obtaining this information from your perspective, perhaps with more details and use case? Thanks!

hi @dannymohammad!

Sorry about the late reply. Yeah i am pursuing a api way right now. Thank you for that.

I was just wondering that getting a user from the otherwise great command line tool isn’t possible since in my opinion that was the easiest way to do it.

Anyway thanks for your reply :slight_smile:

1 Like