Saturday, February 4, 2012

Recently our
team builted around 60+ DR servers in our new datacenter and I thought to register them
in SQL management studio, of course it will take some time to register them all
together and thought that if a script does the same that would be wonderful.

After searching the indernet for sometime I found a

peice of code and tweaked it to register a server and getting an input parameter from a text file.

In the path name I’ve specified \SQLDBOps is which I’ve created under Registered ServersàDatabase EngineàLocal Server Groups and the \SQLRegistration\Database Engine Server Group is the default existing Local Servers Groups.

Code snap

Save the above script in a poweshell file as RegisterServer.ps1
and save your SQL instance names in a txt file as below.

Open the Powershell command window and navigate to the path
where the script and text file exists and execute the file like .\RegisterServer.ps1 SQLSrvrs.txt, the servers
will be registered under your group as below.

3 comments:

We're a group of volunteers and opening a new scheme in our community. Your site provided us with valuable information to work on. You have done an impressive job and our whole community will be thankful to you. gmail login