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-SqlDatabaseAssembly

This function copies assemblies from one SQL Server to another. By default, all assemblies are copied. The -Assemblies parameter is autopopulated for command-line completion and can be used to copy only specific assemblies. The format is databasename.assemblyname.

If the assembly already exists on the destination, it will be skipped unless -Force is specified. Force drops and recreates the database assembly. Dependents are not currently copied over.

Examples

To copy all assemblies from sqlserver2014a to sqlcluster, using Windows credentials. If assemblies with the same name exist on sqlcluster, they will be skipped.

To copy only two assemblies, dbname.assemblyname and dbname3.anotherassembly, from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster. If a assembly with the same name exists on sqlcluster, it will be dropped and recreated because -Force was used.

To see what would happen if the command were executed

Get-Help

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

Source Code

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

Related commands