question

Wilfred van Dijk avatar image
Wilfred van Dijk asked

detect Central Management Server

I've seen several examples how to populate a central management server with subfolders and servers. But I don't know: - the actions to register a server as a central management server. Is there a SP for, or do you have to write the registry? (and where) - the action to query if a CMS is registered Any ideas? thanks!
monitoringmanagement-studiocentral-management-server
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Tom Staab avatar image
Tom Staab answered
Registered servers (either Local Server Groups or Central Management Servers) can be maintained using the SSMS GUI. CMS has the advantage of being managed on a CMS server in tables in the msdb database. If you register several servers using CMS, another user with the proper permissions can access the same set of folders and servers by simply registering that same CMS server. This MSDN article talks about it a little bit and explains the msdb roles used to manage who has admin and reader access to the registered servers. [ https://msdn.microsoft.com/en-us/library/bb934126.aspx][1] Sorry for the delay, but I hope that helps. [1]: https://msdn.microsoft.com/en-us/library/bb934126.aspx
1 comment
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

I want to know how I can setup a CMS by using T-SQL, *not* by using the SSMS. This because I want to automate this process at our customers. I've seen some codingtricks at epmframework.codeplex.com how to read the tree created with CMS, but I still don't know how to register a central manegement server with T-SQL.
0 Likes 0 ·
Tom Staab avatar image
Tom Staab answered
I typically prefer code solutions myself, so I did some more research, and I think I figured out an easy way for you to do this. [ https://www.mssqltips.com/sqlservertip/2397/sql-server-central-management-servers-system-tables/][1] Here's a simple example I just tried: BEGIN TRAN; SELECT * FROM msdb.dbo.sysmanagement_shared_registereed_servers; -- view INSERT msdb.dbo.sysmanagement_shared_registereed_servers_internal -- table (server_group_id, name, server_name, description, server_type) VALUES (1, 'NiceName', 'server\instance', 'My Description', 1) ; SELECT * FROM msdb.dbo.sysmanagement_shared_registereed_servers; -- view COMMIT TRAN; If you then refresh the Central Management Servers node in the Registered Servers windows, you will see the new server (if you already have that management server registered on your machine). [1]: https://www.mssqltips.com/sqlservertip/2397/sql-server-central-management-servers-system-tables/
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.