Backups That Actually Restore When Ransomware Hits

Source: Cybersecurity M15 · Backups That Actually Restore When Ransomware Hits · Click Less, Script More

A backup is not a backup until you have restored from it. Too many admins discover that too late — after ransomware has encrypted the live data, the shared drive, and the one USB drive that was still plugged in. This post shows you how to check your backups with PowerShell, copy them the reliable way, and prove they restore, before you ever need them for real.

The problem

Most backup failures are not discovered on the day the backup runs. They are discovered on the day you need the restore. A backup job can report success while the destination is full, the copy stopped halfway, or the only copy sits on the same disk as the original data. Ransomware makes that worse: if your backup is connected and writable, it can be encrypted just like everything else. The 3-2-1 rule exists to stop that happening — three copies of your data, on two different types of media, with one copy offsite.

If you only have one copy, or if all your copies live on the same server, you do not have a backup strategy. You have a hope. This post turns that hope into a check you can run in a few minutes.

The slow way

The slow way is to open File Explorer, click through each drive, guess how much free space is left, and open a few folders to see whether yesterday’s files are there. Then you copy a folder by dragging it, wait for the progress bar, and hope nothing was skipped. You never test a restore, because restoring sounds risky and time-consuming, so the first real restore is the one that happens during an incident — under pressure, with everyone watching.

That is slow, it is easy to get wrong, and it gives you no evidence that the backup would actually work. A folder that looks full can still be missing the one file you need.

The fast way

Run these checks in PowerShell. They take minutes, they give you numbers you can act on, and you can repeat them every week.

Step 1 — Check your disks. See how much space each drive has, before you copy anything to it:

Get-CimInstance Win32_LogicalDisk

Step 2 — Check that your backup folder exists. Do not assume the drive letter or the folder is still there:

Test-Path D:\Backups

Step 3 — List what is actually in the backup folder. Look at the dates and sizes, and check that recent files are really there:

Get-ChildItem D:\Backups

Step 4 — Copy your data with robocopy. This mirrors D:\Data to E:\Backups\Data, retries twice on a failed file, and waits five seconds between retries:

robocopy D:\Data E:\Backups\Data /MIR /R:2 /W:5

Step 5 — Prove the restore works. Copy a test file from the backup to a separate restore-test folder, and open it there. Do not restore over your live data to test:

Copy-Item D:\Backups\test.txt -Destination D:\Restore-Test\

Apply the 3-2-1 rule to what you just checked: keep the live copy, keep a local backup copy on a different drive, and keep one copy offsite — for example, in cloud backup — so a single incident cannot take all three.

What you should see

Get-CimInstance Win32_LogicalDisk should list your drives with their free space, so you can see at a glance whether the backup drive has room. Test-Path D:\Backups should return True. Get-ChildItem D:\Backups should show recent files with today’s or yesterday’s date, not files from months ago. Robocopy should finish with a summary showing files copied, and no long list of failed files. Finally, the file you copied to D:\Restore-Test\ should open cleanly — that is your proof the backup is not just a folder, but a restore that works.

If it fails

If Test-Path returns False, check the drive letter and the folder name — a backup to a drive that is no longer connected is not a backup. If Get-ChildItem shows old files only, your backup job has not run recently; check its schedule and its last run. If robocopy reports failed files, read its summary, check the destination has enough free space, and run it again — the /R:2 /W:5 options already give it two retries. If the restore test file will not open, stop and investigate before you trust that backup set; a backup you cannot restore from is worse than no backup, because it gives you false confidence.

Tools used

PowerShell, robocopy, and Backblaze for offsite backup: https://www.backblaze.com

Affiliate disclosure: the Backblaze link above is an affiliate link. If you sign up through it, Click Less, Script More may earn a commission at no extra cost to you. It does not change what you pay, and you can use any offsite backup provider that fits the 3-2-1 rule.

Watch the video: https://www.youtube.com/@clicklessscriptmore

Next step

Run the five commands above on your own lab machine this week, and write down three things: how much free space your backup drive has, the date of the newest file in your backup folder, and whether your restore test opened. If any of those three is a surprise, fix your backup before the next ransomware story is about you. Then move on to the next post in this series and keep building the habit of checking, not assuming.

Lab demo · sample data. Test in a lab first.