1

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.

The Details

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: to 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!

  • It sounds like you want an application that can multicast for file transfers. That can work if you are on the same LAN, but it can be problematic if you are on different LANs. – Ron Maupin Jun 8 '17 at 0:11
  • 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 - - how to disable the Windows setting that limits local account use of blank passwords to login only Allowing remote administrative operation without any passwords is just like leaving the door open. – Esa Jokinen Jun 8 '17 at 6:26
1

Honestly, if you're not able to add a password (and set up autologin) then your best bet is probably a third party application like Syncthing or rsync for Windows(cygwin or Deltacopy). Windows is usually pretty reluctant to give administrative share access without a password. The public folder should be shared on the non-public networks by default as well, or you can enable it in the network and sharing center. It should allow passwordless connections.

| improve this answer | |
1

Computers are being kept in a room that only you have access to. If anyone has access to a network jack or wireless outside that room, they DO have full access to those machines.

That being said, If you really want to treat these machines as disposable and keep the blank admin password, it should be possible. I would recommend creating an "IT" or similar account on each of them, and then using that to authenticate for your scripting. If the matching account exists on all machines, they should be able to access the other machines via the Administrative share or otherwise.

I will put in my plug for Powershell to copy the files to the other machines.

$computers = "Machine-1","Machine-2","Machine-3"

# Push the array of computers into the loop to process each one
$computers | ForEach-Object {
    # If the folder doesn't exist...
    If (!Test-Path "\\$_\E$\Folder1\Folder2") {
        # ...create it
        New-Item "\\$_\E$\Folder1\Folder2" -ItemType Directory
    }

    # Copy to other computer recursively (sub-folders) and forceing overwrite
    Copy-Item "E:\Folder1\Folder2\" "\\$_\E$\Folder1\Folder2" -Recurse -Force
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.