net use X: \\$remote_share_path /user:$username $password
Robocopy.exe C:\$local_directory X:\$remote_directory /e /z /dcopy:T /log:$logfile.txt /r:1 /eta /tee /w:1 /ipg:2048
net use X: /del /y
X: - is the path of the network drive I am mounting
/e - Copies subdirectories. Note that this option includes empty directories
/z - Copies files in Restart mode.
/dcopy:T - Copies directory time stamps.
/log:$logfile.txt - outputs copy operations to a log local to the path of execution
/r:1 - only retries once if a transfer fails vs the default which was much much larger and copies would take forever if they got stuck (The default value of N is 1,000,000 (one million retries).)
/eta - Shows the estimated time of arrival (ETA) of the copied files.
/tee - Writes the status output to the console window, as well as to the log file. So I can see the progress live without looking into logs
/w:1 - Specifies the wait time between retries, in seconds. The default value of N is 30 (wait time 30 seconds).
/ipg - is the inner-packet gap explained more here: Robocopy Limiting Bandwidth