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


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


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.



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