Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Create Password for credential
- $passw = convertto-securestring "Password" -asplaintext βforce
- # Assembles password into a credential
- $creds = new-object -typename System.Management.Automation.PSCredential -argumentlist "DOMAINUsername", $passw
- # Select a source / destination path, can contain spaces
- $Source = '\SourceE$Location'
- $Destination = '\DestinationLocation Here'
- # formats the arguments to allow the credentials to be wrapped into the command
- $RoboArgs = "`"$($Source)`" `"$($Destination)`"" + " /e /Copy:DAT"
- # Started Robocopy with arguments and credentials
- Start-Process -credential $creds Robocopy.exe -ArgumentList $RoboArgs -Wait
Add Comment
Please, Sign In to add comment