I cannot for the life of me get the thing to run on a new user laptop setup I'm working on. I'm hoping someone can help. I have been trying to search forums and YouTube videos but would really benefit from having someone maybe help me with my script language/input. I even contacted the prior IT administrator and it didn't result in a full resolution. I'll start with the Robocopy command I've been trying to run in CMD or PowerShell as well as the conversation about this with the prior IT guy.
Here is what I have so far. I have tried with and without " " quotation marks for the file path directory. The most output error message I've gotten is: ERROR Invalid Parameter #3: "\locutionsrv1\Backups\kmcqueen_Backups"
robocopy "C:\Users\Kristi McQueen\" "Z:\\locutionsrv1\Backups\%kmcqueen%_Backups\" *.* /V /S /E /DCOPY:DA /COPY:DAT /Z /XJD /XA:SH /MT:8 /R:2 /W:15 > "C:\Users\Kristi McQueen\Desktop\externalbackup.log"
EDIT:
After running the corrected commands after the first comment, I do get the log file generated on the Desktop with this message in it:
2023/01/04 10:49:36 ERROR 123 (0x0000007B) Accessing Source Directory C:\Users\Kristi Test" \locutionsrv1\Backups\Kristi\ The filename, directory name, or volume label syntax is incorrect.
and then when I try running the commands with %USERNAME% instead of the actual user's name in PowerShell, this is the error message I get:
PS C:\Users\Kristi Test> robocopy "C:\Users\%username%\" "\\locutionsrv1\Backups\%USERNAME%_Backups\" *.* /V /S /S /DCOPY:DA /COPY:DAT /Z /XJD /XA:SH /MT:8 /R:2 /W:15 > "C:\Users\%USERNAME%\Desktop\externalbackup.log"
out-file : Could not find a part of the path 'C:\Users\%USERNAME%\Desktop\externalbackup.log'.
At line:1 char:1
+ robocopy "C:\Users\%username%\" "\\locutionsrv1\Backups\%USERNAME%_Ba ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (:) [Out-File], DirectoryNotFoundException
+ FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand
This is unbelievably frustrating and confusing as I made sure these folders/files exist and there's no issue with Access or Permissions, right?
EDIT 2: 1/5/23:
This is SO FRUSTRATING! I want to pull my hair out! I got the following command to work, I think, sort of, for a minute: robocopy C:\Users\ \\locutionsrv1\Backups\%USERNAME%\ *.* /V /S /S /DCOPY:DA /COPY:DAT /Z /XJD /XA:SH /MT:8 /R:2 /W:15
However, now it's not working. And when I check the Destination folder on the server to see what was backed up, the folder is named %USERNAME% and not the actual user's name! And it won't generate a log file to the user's desktop as I originally intended.
I want to bang my head against a wall. Now even that command that WAS working no longer is. In CMD, I'm back to getting the: "ERROR : Invalid Parameter #3 : "Test" message.
And in PowerShell I get:
2023/01/05 14:19:04 ERROR 1326 (0x0000052E) Creating Destination Directory \locutionsrv1\Backups\ The user name or password is incorrect. PS C:\Windows\system32> robocopy "%userprofile%" "\locutionsrv1\Backups%USERNAME%_Backups" . /V /S /E /DCOPY:DA /COPY:DAT /Z /XJD /XA:SH /MT:8 /R:2 /W:15 > "%UserProfile%\Desktop\externalbackup.log" out-file : Could not find a part of the path 'C:\Windows\system32%UserProfile%\Desktop\externalbackup.log'. At line:1 char:1
- robocopy "%userprofile%" "\locutionsrv1\Backups%USERNAME%_Backups" ...
+ CategoryInfo : OpenError: (:) [Out-File], DirectoryNotFoundException + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand