Getting a list of all users in a DNN instance using SQL

Overview

If you would like to get a list of users who had logins for the site, you can export all users on your site using a simple SQL query run through the SQL Console.

 

Solution

  1. Log in to a SuperUser Account.
  2. Go to Persona Bar > Settings > SQL Console
  3. Run the following SQL query, replacing the # with your desired PortalId:
    • SELECT users.userid
      	,users.username
      	,users.email
      	,roles.rolename
      FROM userportals
      INNER JOIN users ON userportals.userid = users.userid
      INNER JOIN userroles ON userportals.userid = userroles.userid
      INNER JOIN roles ON userroles.roleid = roles.roleid
      WHERE userportals.portalid = #
  4. When the results are displayed, you can press the Export button (see attached image) and select which type of file you want the results exported to.

sqlconsole.jpg

 

 

 

Comments

1 comment

  • Avatar
    Margo Janosi

    Hello, 

    This has been FABULOUS for me to get the information I need; however, I also need to export the information under Profile Settings --> Security , but don't know the table command. 

    users
    roles

    Work fabulously - how do I get the security info? Thanks!

    0
    Comment actions Permalink

Please sign in to leave a comment.