Guest User

Untitled

a guest
Aug 22nd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. # Create Password for credential
  2. $passw = convertto-securestring "Password" -asplaintext –force
  3. # Assembles password into a credential
  4. $creds = new-object -typename System.Management.Automation.PSCredential -argumentlist "DOMAINUsername", $passw
  5. # Select a source / destination path, can contain spaces
  6. $Source = '\SourceE$Location'
  7. $Destination = '\DestinationLocation Here'
  8. # formats the arguments to allow the credentials to be wrapped into the command
  9. $RoboArgs = "`"$($Source)`" `"$($Destination)`"" + " /e /Copy:DAT"
  10. # Started Robocopy with arguments and credentials
  11. Start-Process -credential $creds Robocopy.exe -ArgumentList $RoboArgs -Wait
Add Comment
Please, Sign In to add comment