locked
Backing up files into a remote server using power-shell PSdrive and Xcopy. RRS feed

  • Question

  • Tried to Copy files into a PSDrive but powershell creates a new directory and copies the files into it. What should I do,
    New-PSDrive -Name "Backup" -PSProvider Filesystem -Root "\\Mssqlstd\f$\TestBackupDestination" 
     $source = "D:\temp" 
     $destination = "backup" 
    xcopy $Source $Destination /c /s /e /r /h /d /y /x
    Remove-PSDrive "Backup" 
    
    

    Tuesday, October 10, 2017 3:29 AM

All replies

  •  What should I do,
    It depends what you want to do. If it's about copying files you can do this:
    robocopy "D:\Temp" "\\Mssqlstd\f$\TestBackupDestination" /E /COPYALL


    Grüße - Best regards

    PS:> (79,108,97,102|%{[char]$_})-join''

    Tuesday, October 10, 2017 6:05 AM