dbatools is a free PowerShell module with over 100 SQL Server administration, best practice and migration commands included.


Get-SqlRegisteredServerName

This command gets a list of SQL Server names stored in SQL Server Central Management Server as a simple array.

Examples

Get a list of all server names from the Central Management Server on sqlserver2014a, using SQL Authentication

Gets a list of server names in the HR and Accounting groups from the Central Management Server on sqlserver2014a.

Screenshots

regnames

From PowerShell, execute   Get-Help Get-SqlRegisteredServerName -Detailed   for more information on this function. Want to see the source code? See it on GitHub