Friday, March 23, 2012

Script to add groups and register servers in those groups

We have several different environemnts with several servers in each.

We now want to share SQL Server Admin around the group.

I would like to create a script that would add each server group and register each server in the appropriate group

Something Like

exec sp_addservergroup 'Dev'

exec sp_registerserver 'Dev', 'AccountingDev'

exec sp_registerserver 'Dev', 'MarketingDev'

exec sp_addservergroup 'Test'

exec sp_registerserver 'Dev', 'AccountingTest'

exec sp_registerserver 'Dev', 'MarketingTest'

exec sp_addservergroup 'Prod'

exec sp_registerserver 'Dev', 'AccountingProd'

exec sp_registerserver 'Dev', 'MarketingProd'

I've looked in books online and googled but can't seem to lay my finger on the TSQL solution, if there is one. Thanks In Advance for any help

MPM

Hi,

first as I saw the names of that procedured I was puzzled though they looked like procedures in SQL Server but I wasn′t aware of. I overread you "something like" statement. I assume that you want to add these server to the Enterprise manager for adminstering them. But EM is a client application, though executing these scripts on the server wouldn′t affect the client at all (beside that they don′t exists :-) ) What you can do is to open up MMC, add a snapin (The SQL Server Managment Console) and add the appropiate servers, afterwards you can just save (as..) the msc file as a administrative template which can be shared with your peers / colleagues.


HTH, Jens Suessmeyer.


http://www.sqlserver2005.de

|||Thanks, Jens, that is a winner.|||Is there any way out to do the same thing but via T-SQL script only ?
More-over in which table the entries go?

Thks|||No, those registrations are part of the client tool and NOT part of the database so there is no T-SQl or any other command (except the GUI) to create server groups and register servers. As such, they are also NOT stored in the database at all, but in a snap-in file on the client machine that has the tool installed.|||

In such a case, then what would be the windows script or VBA script who can read and list the available groups and database servers available in it.

thks

Kuljit

No comments:

Post a Comment