Powershell to Robocopy files (say, to back up your computer to protect against CryptoWall trojan)

We were having a good time on DBAs@Midnight, when Sean got a weird pop up message that said all his files were encrypted, and he has to pay a large amount of money via Bitcoin to get the encryption key. The show quickly ground to a halt as he, then he and Freddie, then all three of us PLUS the chatroom, looked into what this was, how to stop it, what to do, and so on.

In short: Sean lost just about everything. He lost most of what he has on his computer. He lost all the important files that he’d made sure were copied offsite to OneDrive – CryptoWall encrypted those too. (You might want to wait a few weeks before mentioning it in his presence, seriously.)

The funny thing is, we’re data professionals, and we thought we were reasonably well covered for backup. Okay, OneDrive isn’t perfect/ideal, but we neglected to imagine the scenario that didn’t just affect one computer, or one home network, but also spread to The Cloud of Awesomeness.

It’s not the final solution, but…

You’re going to want to get yourself something like Carbonite Cloud Backup (though I wonder, if you have the constant update turned on, whether this would be an advantage against the CryptoWall encryption…probably ONLY if Carbonite keeps file versions).

AND you’re going to want to do regular (say, monthly or so) backups to an external hard drive. I have my Documents folder, my Dropbox folder, and several folders on the root, and even with Robocopy (it comes with Windows!), I found it a little bit of a pain to copy specific things over. So, Powershell!

This script – RobocopyToDest.txt* – lets you define a source, destination, and exclusions (e.g., “don’t copy over the XYZ folder”) to copy a set of directories. It’s a rough cut, I-just-made-this script, but I rant it and it works beautifully. Take it and adjust to your own needs, and for heaven’s sake back up your files!

 *Save RobocopyToDest.txt with a .PS1 file extension. WordPress doesn’t like saving script files, and I don’t like zipping up tiny text files. 

Read up on this stuff

3 thoughts on “Powershell to Robocopy files (say, to back up your computer to protect against CryptoWall trojan)”

Leave a Reply

Your email address will not be published. Required fields are marked *