How remotely add SA group to SQL Servers?

  • I have two questions:

    1. How to add a Local Administrator to remote servers?

    2. How to add SA group to remote SQL Servers?

    After connecting to a machine, I run

    net localgroup administrators "domain\security group" /add

    to add a security group to Administrators.

    But the question is how to do it remotely from my local machine and to more than 1 remote server. (There are about 100 machines):w00t:

    And I run

    Exec sp_addsrvrolemember 'domain\security group' 'sysadmin'

    to add SA group to a SQL Server.

    And in this case, the question is how to add a security group with sysadmin role from my local machine to all 50 remote SQL Servers.

    Any suggestions greatly appreciated,

    MGL.

  • You have to connect to each SQL Server and run this. There isn't another way.

    You can write a script using sqlcmd to do this, looping through the list of servers, or just use something like Excel to generate the script:

    http://www.sqlservercentral.com/articles/DTS/datamigrationquicklyinsertingnewdata/1419/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply