Monday, February 20, 2012

Register Multiple Servers in Enterprise Manager

I am looking for a way to register several hundred SQL Servers/Instances in
Enterprise manager without having to do them one by one.
Does anybody know of a way to do this?
Doing this via VBScript would be nice.Although I haven't tried it...you might take a look at RegisteredServer
Object in the SQL Server Books Online.
HTH
Jerry
"brimhj" <brimhj@.discussions.microsoft.com> wrote in message
news:854EA219-DF4B-4EF4-9C9F-785C5419E9DF@.microsoft.com...
>I am looking for a way to register several hundred SQL Servers/Instances in
> Enterprise manager without having to do them one by one.
> Does anybody know of a way to do this?
> Doing this via VBScript would be nice.|||Use the SQLDMO.Application Object and script a solution
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sqldmo/dmoref_ob_a_8zw4.asp
"brimhj" <brimhj@.discussions.microsoft.com> wrote in message
news:854EA219-DF4B-4EF4-9C9F-785C5419E9DF@.microsoft.com...
>I am looking for a way to register several hundred SQL Servers/Instances in
> Enterprise manager without having to do them one by one.
> Does anybody know of a way to do this?
> Doing this via VBScript would be nice.|||brimhj wrote:
> I am looking for a way to register several hundred SQL
> Servers/Instances in Enterprise manager without having to do them one
> by one.
> Does anybody know of a way to do this?
> Doing this via VBScript would be nice.
You might be able to copy the registry keys as they appear in the
following key:
HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL
Server\80\Tools\SQLEW\Registered Servers X
Under that key is one or more SQL Server Groups. The servers are listed
under each group as a binary key.
The actual name of the server as it appears in SQLEM is in the binary
value, not the name of the value. The name is descriptive only.
If you export the group and apply the entries to another computer, it
might work. I've only tried copying an entry locally and same server
appears twice in SQLEM.
--
David Gugick
Quest Software
www.imceda.com
www.quest.com|||Use at your own risk !
----
Const DefServerGroup = "SQL Server Group"
Set objDMOApp = CreateObject("SQLDMO.Application")
'Call AddServersFromFile("C:\Temp\ServerList.txt")
'Call AddRegServer("SERVERNAME",1)
'Call RemRegServer("TEST")
For Each ServerGroup In objDMOApp.ServerGroups
Call IterateGroups(ServerGroup)
Next
Sub IterateGroups(ParentGroup)
WScript.StdOut.WriteLine ParentGroup.Name
For Each RegisteredServer In ParentGroup.RegisteredServers
WScript.StdOut.WriteLine RegisteredServer.Name
Next
For Each ServerGroup In ParentGroup.ServerGroups
WScript.StdOut.WriteLine ServerGroup.Name
Next
End Sub
Sub AddRegServer(Name,UseTrustedConnection)
Set NewRegServer = CreateObject("SQLDMO.RegisteredServer")
NewRegServer.Name = Name
NewRegServer.UseTrustedConnection = UseTrustedConnection
Set DefaultGroup = objDMOApp.ServerGroups(DefServerGroup)
DefaultGroup.RegisteredServers.Add NewRegServer
End SUb
Sub RemRegServer(Name)
Set DefaultGroup = objDMOApp.ServerGroups(DefServerGroup)
DefaultGroup.RegisteredServers.Remove Name
End Sub
Sub AddServersFromFile(FileSpec)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTS = objFSO.OpenTextFile(FileSpec)
While NOT objTS.AtEndOfStream
Call AddRegServer(objTS.ReadLine,1)
Wend
End Sub
----
"David J. Cartwright" <davidcartwright@.hotmail.com> wrote in message
news:OgFzuC6vFHA.1012@.TK2MSFTNGP09.phx.gbl...
> Use the SQLDMO.Application Object and script a solution
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sqldmo/dmoref_ob_a_8zw4.asp
>
> "brimhj" <brimhj@.discussions.microsoft.com> wrote in message
> news:854EA219-DF4B-4EF4-9C9F-785C5419E9DF@.microsoft.com...
>>I am looking for a way to register several hundred SQL Servers/Instances
>>in
>> Enterprise manager without having to do them one by one.
>> Does anybody know of a way to do this?
>> Doing this via VBScript would be nice.
>

No comments:

Post a Comment