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

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Get-DbaRegisteredServer

This command gets a list of SQL Server registered servers stored in SQL Server Central Management Server.

Screenshots

dbatools-Get-DbaRegisteredServer

Examples

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

Get-DbaRegisteredServer -SqlServer sqlserver2014a -SqlCredential $credential

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

Get-DbaRegisteredServer -SqlServer sqlserver2014a -Group HR, Accounting

Find databases on Development and Production servers that aren’t online. Some commands don’t accept pipeline input, but for those that do, this is very powerful.

Get-DbaRegisteredServer -SqlServer MySqlCmsServer -group development,production | get-dbaDatabaseState | Where-Object {$_.Status -ne ‘ONLINE’} | format-table

Author

This command was created by Bryan Hamby. You can find Bryan on Twitter.

Get-Help

From PowerShell, execute Get-Help Get-DbaRegisteredServer -Detailed for more information on this function.

Source Code

Want to see the source code? View Get-DbaRegisteredServer.ps1 on GitHub
 

Related commands