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-HelpFrom PowerShell, execute Get-Help Copy-SqlTargetServer -Detailed for more information on this function.
Source CodeWant to see the source code? View Copy-SqlTargetServer.ps1 on GitHub