February 24, 2010 at 4:31 am
I want to create domain logins for almost 10 users but i want to use script for this task. All users should get admins rights on all the databases. Could anyone please provide me this script.
Thanks a ton in advance.
Nitin
February 24, 2010 at 10:37 am
Creating a new DBA group? The domain logins must be created before you can add them to SQL Server. You can use CREATE LOGIN and sp_addsrvrolemember to give the login access to SQL Server and make it a member of sysadmin.
Something like this:
create login DOMAIN\NEWLOGIN from windows
go
sp_addsrvrolemember 'DOMAIN\NEWLOGIN', 'sysadmin'
Greg
February 24, 2010 at 11:21 am
Thanks so much for your suggestion,
But what i want to achieve is we already have a domain id's and i want to add them to SQL logins using script so i am looking for the script.
Domain is R2 and username like 501253666.
February 24, 2010 at 5:28 pm
Just substitute R2\501253666 for DOMAIN\NEWLOGIN. Repeat the two statements for each login and run the script in a query window in SSMS
Greg
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply