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

Apologies if this gets reposted, tech probs first time round

Moving the thread to Tools forum since this is not a TSQL feature.|||I don't believe there is a T-SQL solution to this however you should be able to right click on the registered servers tree in SSMS and export the registered servers from there.

No comments:

Post a Comment