Create SQL login to multiple instances at once

Posted on

Question :

I have a AD group that needs to be added to multiple SQL instances, I am wondering is there a quicker way of adding this group at once rather than having to login to each server and creating a login in SQL?


Answer :

Download the awesome Powershell scripts from dbatools and use New-DbaLogin to add the new login.


New-DbaLogin -SqlInstance sql1 -Login domainuser

You can set up a Central Management Server. Once you’ve done that, you can apply the same script (CREATE LOGIN [Your_AD_Group] FROM WINDOWS WITH ...) to multiple SQL instances at the same time.

Leave a Reply

Your email address will not be published. Required fields are marked *