Copy backup file between different domains using mapped network drives

How to copy backup files between to different domains having trust relationship?

use master
go
exec xp_cmdshell 'net use Z: \sourceserverH$Backups password /user:domainusername'
go
exec usp_copybackupfiles 
@searchdirectory='Z:',
@filefilter='.bak',
@database='AdventureWorks2014',
@Destination='H:Backupscopyfiles'
go
Exec master.dbo.xp_cmdshell 'net use Z: /delete'
go

 

Leave a Reply

Your email address will not be published. Required fields are marked *