How to Auto-Backup a Folder with PowerShell (No Extra Software)

You don't need a backup app to keep a folder safe — PowerShell can copy it somewhere else on a schedule, for free, using tools already built into Windows. Here's a script that works, plus two ways to actually run it automatically.

The script

This copies a source folder to a destination, timestamps each backup, and keeps only the 7 most recent copies so it doesn't fill your drive.

$source = "C:\Users\YourName\Documents\Important"
$destinationRoot = "D:\Backups"
$timestamp = Get-Date -Format "yyyy-MM-dd_HH-mm"
$destination = Join-Path $destinationRoot "Backup_$timestamp"

Copy-Item -Path $source -Destination $destination -Recurse

# Keep only the 7 most recent backups
Get-ChildItem $destinationRoot -Directory |
  Sort-Object CreationTime -Descending |
  Select-Object -Skip 7 |
  Remove-Item -Recurse -Force

Save it as backup.ps1, update the two paths at the top, and run it once manually to confirm it works before you automate it.

Option 1: Task Scheduler (free, built-in)

Open Task Scheduler, create a new task, and set the action to run powershell.exe with the argument -ExecutionPolicy Bypass -File "C:\path\to\backup.ps1". Set a daily trigger and you're done. The catch: Task Scheduler's UI is clunky for anything beyond a single trigger, and it won't show you a clean history of whether each run actually succeeded.

Option 2: A dedicated scheduler with a GUI

If you want to see run history at a glance, retry failed runs, or manage more than one script without digging through Task Scheduler's menus, that's exactly what we built PoshRocket Scheduler for — it runs your .ps1 files as a real Windows Service, with cron, interval, or daily triggers and a run log you can actually read.

Also worth having: if the folder you're backing up is genuinely important, a local copy isn't enough on its own — pair this script with an off-site backup like Backblaze so a drive failure or theft can't take both copies out at once.

A note on destinations

Copying to a second internal drive protects you from file corruption or accidental deletion, but not from theft, fire, or drive failure taking out your whole PC. Point $destinationRoot at an external drive or a cloud-synced folder (Dropbox, OneDrive, Google Drive) if you want backups that survive your machine dying entirely.

Disclosure: Some links in this post are affiliate links. If you buy through them, we may earn a small commission at no extra cost to you. We only recommend tools we'd use ourselves.