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?



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


New-DbaLogin -SqlInstance sql1 -Login domain\user

  • It doesn't work, I have downloaded the .zip from dbatools and I am trying to execute the command but keep receiving a error the term 'new-DbaLogin' is not recognised as the name of a cmdlet – Vishal Jan 30 at 15:17
  • @Vishal Read the getting started page for information on how to import the module, and more. – LowlyDBA Jan 30 at 15:19
  • I have downloaded the .zip, my PS version is 3 I extracted the folder in my C: but when I execute the command I receive the same error....I am fairly new to Powershell so any further help would be appreciated thank you – Vishal Jan 30 at 15:34
  • @Vishal - make sure you follow the instructions for Method 4: Download the zip directly and manually import the module. - dbatools.io/download - particularly the information about Once you’ve extracted the folder, make sure you rename it from dbatools-master or dbatools-development to plain o’ dbatools and place it somewhere in $env:PSMODULEPATH – Scott Hodgin Jan 30 at 15:37

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.