It’s pretty simple actually. If your source is T:SUBDIR and destinations are 10.10.10.1VOLUME, 10.10.10.2VOLUME, 10.10.10.2VOLUME, then something like:[code]FOR %F IN (10.10.10.1VOLUME 10.10.10.2VOLUME 10.10.10.2VOLUME) DO START ROBOCOPY T:SUBDIR %FSUBDIR /MIR /COPY:ALL /R:3 /W:3[code]I would also recommend testing to make sure your command is correct by using echo:
[code]FOR %F IN (10.10.10.1VOLUME 10.10.10.2VOLUME 10.10.10.2VOLUME) DO ECHO START ROBOCOPY T:SUBDIR %FSUBDIR /MIR /COPY:ALL /R:3 /W:3[code]Backup programs can also add their own additional point of failure though if a restore has to be done through the backup program. This is why I’ve stuck with straight file copies for backups.
you need to import the webadministration module first
run this command
import-module webadministrationYou are welcome to share such tricks with specific commands, readers would appriciate that.
For backups in general I prefer more sophisticsted tools, like free and great Cobian Backup with its own service, schedule, compressions etc..
How in the world is robocopy finding corruption and correcting it? afaik robocopy doesn’t have a built-in compare function.
Surender Kumar commented on
How to change Remote Desktop port (RDP port) using PowerShell 20 hours, 31 minutes ago
Additionally, if you access remote desktop from known IP addresses only, it is a good idea to modify the firewall rules to permit your custom RDP port for known IP addresses only to make it more secure.
Surender Kumar commented on
How to change Remote Desktop port (RDP port) using PowerShell 20 hours, 40 minutes ago
You’re right. VPN is the way to go for RDP access over internet but port obfuscation also helps a bit to keep dumb-bots in check who keep knocking on the default ports.
Job Cacka commented on
How to change Remote Desktop port (RDP port) using PowerShell 1 day, 3 hours ago
After doing this attempt to run nmap against those ports. I believe the command is this.
#nmap -p0- -v -A -T4It should show that the obfuscation of changing the port number is easily detected and VPN is absolutely necessary.
Thanks for posting this. I have used the MIR function of Robocopy to maintain a software distribution scheme so that all of the destinations end up with the same files as the source regularly. It “finds” corruption and corrects it nicely against a known good copy and helps force good update practices.
tested and confirm, this script is no longer working – you must update parts of this with updated GUID’s to get it working again
I use robocopy to copy bulk data on my eDiscovery servers and it still works great. You did a great job explaining its use cases. Thank you Leos.
A lot of sites have more details on the switches, but it is also hit and miss on how well it works depending on the source and destination.
For one backup operation I had to make a ‘fall’ and ‘spring’ set since when dst kicked in, robocopy would copy everything again and not just the changed files.
It might also be worth mentioning a few tricks for copying and comparison.
For copying from one source to multiple destinations, using the ‘start’ command in a ‘for’ loop can start the copies simultaneously and allow the 100% cache hit to effectively double the copy speed since the original is basically only being read once and written twice. I’ve used this for up to 4 destinations simultaneously and it works best with similar destinations. Even when the destinations are not similar and the individual robocopy sessions become ‘off sync’ from each other, the latency of hitting the disk usually brings them back into alignment because one of the sessions has a cache hit while the other is still going to disk.
For comparison, MS’s own windiff is a pretty good way to compare entire tree branches. However, if one needs to compare a single source to multiple destinations, winmerge does a better job since it has the ability to actually compare a single source to 2x destinations. And being a portable program that runs on the various windows platforms (just like windiff), it’s another handy tool that can check the work of a robocopy session for bit by bit accuracy.
Wolfgang Sommergut wrote a new post,
Run Windows Terminal as admin 2 days, 8 hours ago
Like with cmd.exe or PowerShell, you often have to run Windows Terminal as admin to execute commands that need elevated privileges. In Windows Terminal, you can configure the elevation of privileges for an individual shell or for all shells. However, you have to expect some inconsistencies and peculiarities.
It may be worth mentioning that the various Robocopy exit codes for successes and failures. 0 through 7 are all successes, 8 through 16 are failures.
Yes, End to end automation is possible from installation to managing in vcenter.
I have never used robocopy on any other system than NTFS. Yes there is that switch which somehow filters the file selection. No idea how it works and the description in help is not much useful. 🙂
It actually does between non-NTFS file systems/nas units. There is even the /DST switch to help with the issue.
- Load More