I'm looking to automate a copying job that I usually do manually. I've never worked with scripting, and I have little networking knowledge, so it's entirely possible that the answer is simpler than I realize, but I've had no luck so far.
I have several Windows 10 computers all plugged into the same router, in one room. I never did any kind of set up for a formal workgroup or connection between any of them. They all have one local administrator account with the same name and a blank password.
I have a tree of folders and files that I want to copy from a USB drive to one computer, and then instead of me carrying the USB drive to each computer to manually copy, I want that computer to distribute it (with this proposed script) to the other computers in the room.
What I've Tried
After spending about twenty minutes fishing through some initial ideas, I decided to try robocopy. In particular, I was attracted to the /mir option that would mirror the destination to the source, deleting folders and files that were no longer valid. Since I need to do this task daily, and it uses the same folder structure each time, I am interested in removing files that are no longer in the source.
After the data was already copied from the USB drive to machine-1, my first command looked like this:
robocopy E:\Folder1\Folder2 \\machine-2\E:\Folder1\Folder2 /mir /log:"robocopy.log"
And I got an error letting me know that robocopy wasn't happy about blank passwords. Some further research taught me that this is a remote Windows thing, and that generally you can't do blank passwords on Windows when remotely accessing other machines.
While I understand that giving them all a password is the superior security choice, we originally decided to leave the passwords blank on the machines because they're kept in a room that only we have the key to, and it's much much easier for us to access them if we don't have to type the password every time (several times a day). It's 100% for convenience. So while we're certainly willing to add passwords to all of the machines if necessary, it would be nice if we could keep them omitted for now. With that in mind, I managed to find this older post, which shows the user how to disable the Windows setting that limits local account use of blank passwords to login only: http://dandar3.blogspot.com/2008/04/windows-vista-allow-remote-desktop.html
After disabling that setting on two machines I was testing between, I tried running that same command again. This time, I got two different errors (and in this order):
ERROR 5 (0x00000005) Getting File System Type of Destination \\machine-2\E:\Folder1\Folder2 Access is denied. ERROR 5 (0x00000005) Creating Destination Directory \\machine-2\E:\Folder1\Folder2 Access is denied.
So then I thought it sounded like a permissions issue. I tried fiddling with the permissions of Folder1 on the destination machine (in this example, machine-2), and after I wasn't getting different results, I just gave the Windows group Everyone full control over the entire folder. But even that didn't change the errors.
After that, I found another forum post that suggested sharing the folder. So I right-clicked on the E drive of the destination machine and selected Share With -> Advanced Sharing -> Advanced Sharing, and chose to share the folder, calling it E. The result made it seem (to my amateur mind) like I'd set it up properly: see screen clipping
So then I changed
E$ in my command, as suggested in the forum post, like so:
robocopy E:\Folder1\Folder2 \\machine-2\E$\Folder1\Folder2 /mir /log:"robocopy.log"
But unfortunately, it still had no effect.
Finally, I came across this Stack Overflow answer about using robocopy to copy between machines on two different domains, using a
net use command. I wanted to test that line by itself before making a batch out of it, so I typed in:
net use \\machine-2\e$ /user:machine-1\myusername ""
And this command ALSO came back with
System error 5 has occurred. Access is denied.
But this was while the E drive on machine-2 was still shared, and still had full control granted to Everyone. This stumped me too.
I've come to a point where I'm certain that my lack of knowledge regarding network setup and robocopy is probably sending me toward potential solutions that are either more complicated than they need to be, or are very hacked together in a duct tape sort of fashion. I don't just want to find the "right" answer, but I want to understand it as well.
Is there a better way to automate the task I'm trying to automate? If robocopy is the best way, then where is the culprit in the above problem? Is it something I need to set up network-wise, or am I not using the command itself properly? Or do I just need a better set of keywords/search terms for finding a clearer answer myself?
Assistance or guidance are very much appreciated!