dbatools is a free PowerShell module with over 200 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


Copy-SqlCentralManagementServer

This command copies all groups, subgroups, and registered servers from one SQL Server to another. By default, all objects are copied.

The -SqlCmsGroups parameter is autopopulated for command-line completion and can be used to copy only specific groups.

If the group or registered server already exists on the destination, it will be skipped unless -Force is specified. Force drops and recreates the object.

Examples

To migrate all groups, subgroups, and server instances are copied from sqlserver’s Central Management Server to sqlcluster’s Central Management Server.

To migrate top level Group1 and Group3, along with its subgroups and server instances are copied from sqlserver to sqlcluster.

To migrate top level Group1 and Group3, along with its subgroups and server instances are copied from sqlserver to sqlcluster. When adding sql instances to sqlcluster, if the server name of the migrating instance is “sqlcluster”, it will be switched to “sqlserver”. If SwitchServerName is not specified, “sqlcluster” will be skipped.

Get-Help

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

Source Code

Want to see the source code? View Copy-SqlCentralManagementServer.ps1 on GitHub
 

Related commands