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


Copy-SqlBackupDevice

Copies one or more backup devices. Copies both SQL code and the backup file itself. Backups are migrated using Admin shares. If destination directory does not exist, SQL Server’s default backup directory will be used.

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

If backup device with same name exists on destination, it will not be dropped and recreated unless -Force is specified. Force drops and recreates the backup device.

Examples

Copies all server backup devices from sqlserver2014a to sqlcluster, using Windows credentials. If backup devices with the same name exist on sqlcluster, they will be skipped.

Get-Help

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

Source Code

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

Related commands