• goher2000 - Friday, March 9, 2018 1:31 PM

    you can probably avoid additional resources used by power-shell by simply mapping the drive on the destination server through tsql and restore the backup, you do not even need to copy file

    exec xp_cmdshell "net use x: \\sourceserver\backupdir /user:domain\user password"
    go
    restore database demodb from disk='x:\demodb.bak'
    go
    exec xp_cmdshell "net use x: /delete"
    go

    GOD NO!!!!   NEVER EVER PUT A PASSWORD IN CLEAR TEXT!!!!

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)