SQL Login users export

Subash Thangaraj 1 Reputation point
2021-05-18T06:21:08.217+00:00

how to export all SQL login users list ? is the any tools

SQL Server | Other
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 47,436 Reputation points
    2021-05-18T06:53:42.137+00:00

    If you want just a plain list, then you can query all SQL logins with

    select *  
    from sys.server_principals  
    where type = 'S'  
    order by name  
    

    If you want to transfer SQL logins to different SQL Server, then you can use the Microsoft support script: Transfer logins and passwords between instances of SQL Server

    0 comments No comments

  2. AmeliaGu-MSFT 14,006 Reputation points Microsoft External Staff
    2021-05-19T03:08:20.507+00:00

    Hi @Subash Thangaraj ,
    Welcome to Microsoft Q&A.
    We also can use dbatools in PowerShell to copy SQL server login.
    To install dbatools, we can use Install-Module dbatools in PowerShell. Please refer to this article for more details.
    Then we can use Copy-SqLogin and Export-SqlLogin to copy or export SQL Server login.
    In addition, please refer to Migrate SQL Server Logins with PowerShell and Move or copy SQL Logins by assigning roles and permissions which might help.

    Best Regards,
    Amelia


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.