Introduction
Let’s be real: we all treat the Downloads folder like it’s a personal dumping ground—stuffed with random PDFs we needed “just this once,” that 47th screenshot of the same error message, and the installer for a program we used exactly once in 2019. But even though half of it feels totally useless, every so often, there’s a gem hidden in there—like that invoice you actually need come tax time.
After one too many frantic “Oh no, I forgot to save that file before wiping my PC!” moments, I realized it was time to move my Downloads folder to the cloud. Enter OneDrive. Now all those random (but occasionally important!) files are backed up and available anywhere, no more frantic manual copying before every reset.
Why Bother Moving Downloads to OneDrive?
- Peace of Mind for PC Resets
You know that sinking feeling when it’s time to wipe your machine, and you have to comb through Downloads, thinking “Do I need that random .zip from 2020?” By syncing to OneDrive, you can skip the panic—everything’s in the cloud already. - Grab Your Files Anywhere
Whether you’re on a different computer, a tablet, or just your phone, those random files are available in OneDrive. Need a PDF you downloaded last week while you’re on vacation? It’s a few clicks away. - Accidental Importance
Sure, you might think, “That’s just a bunch of junk.” But trust me, the day will come when you need that “junk.” Syncing means you don’t lose that one crucial doc you half-remember from months ago. - Easy Sharing
Let’s say you want to send your coworker that handy little tool you downloaded. No need to re-download or rummage around. Grab the OneDrive link, share it, done. No more “Now I have to find it in that giant pile of stuff.”
Prerequisite for Intune Remediation Scripts
To deploy this script as an Intune Remediation Script, make sure you have the appropriate license level that supports it (e.g., Microsoft 365 E3/E5, Enterprise Mobility + Security E3/E5, or an equivalent plan with Intune Remediation Script capabilities).
The Magic PowerShell Script
I put together (and tested, a few dozen times, because I’m paranoid) a PowerShell script that checks if your Downloads folder is already on OneDrive. If not, it moves everything over and updates Windows so it knows where to look. Here it is:
<#
.SYNOPSIS
Detects and remediates the current user's Downloads folder to point to OneDrive.
.DESCRIPTION
1. Checks if the current known folder for Downloads is already set to OneDrive\Downloads.
2. If not, it moves existing files from the old Downloads folder, creates a OneDrive\Downloads folder if needed,
and updates registry keys so that Windows recognizes the new location as "Downloads."
3. Returns 0 (success) if already compliant or successfully remediated, 1 (error) if it fails.
.NOTES
Run in user context, because it edits HKCU keys.
#>
try {
# ------------------------------------------------------------
# 1) Identify OneDrive path and desired Downloads path
# ------------------------------------------------------------
$oneDrivePath = $env:OneDrive
if (-not $oneDrivePath) {
Write-Host "OneDrive is not configured or the environment variable is missing."
Write-Host "Not Compliant"
exit 1
}
# Normalize the OneDrive path (if it exists on the system)
$oneDriveFullPath = Resolve-Path -Path $oneDrivePath -ErrorAction Stop
# Construct the target Downloads path inside OneDrive
$desiredDownloadsPath = Join-Path $oneDriveFullPath "Downloads"
# ------------------------------------------------------------
# 2) Detect: Check if current Downloads folder is already pointing there
# ------------------------------------------------------------
# Known Folder GUID for Downloads = {374DE290-123F-4565-9164-39C4925E467B}
$currentRegPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"
$currentDownloadsValue = (Get-ItemProperty -Path $currentRegPath -Name "{374DE290-123F-4565-9164-39C4925E467B}" -ErrorAction SilentlyContinue)."{374DE290-123F-4565-9164-39C4925E467B}"
if ($currentDownloadsValue -and (Split-Path $currentDownloadsValue -Parent) -eq (Split-Path $desiredDownloadsPath -Parent)) {
# The registry path might be the same or a slightly different format, let's do a direct string compare
if ([string]::Equals($currentDownloadsValue, $desiredDownloadsPath, "InvariantCultureIgnoreCase")) {
Write-Host "Downloads folder is already mapped to OneDrive. Compliant."
exit 0
}
}
# ------------------------------------------------------------
# 3) Remediate
# ------------------------------------------------------------
Write-Host "Remediation needed. Setting Downloads to: $desiredDownloadsPath"
# Create the OneDrive\Downloads directory if it does not exist
if (-not (Test-Path $desiredDownloadsPath)) {
New-Item -ItemType Directory -Path $desiredDownloadsPath -ErrorAction Stop | Out-Null
Write-Host "Created new directory: $desiredDownloadsPath"
}
# Move existing files from old Downloads to new location (if old folder exists)
$oldDownloadsPath = Join-Path $env:USERPROFILE "Downloads"
if (Test-Path $oldDownloadsPath) {
$itemsToMove = Get-ChildItem -Path $oldDownloadsPath -Force -ErrorAction SilentlyContinue
if ($itemsToMove) {
Write-Host "Moving existing files from '$oldDownloadsPath' to '$desiredDownloadsPath'..."
Move-Item -Path (Join-Path $oldDownloadsPath "*") -Destination $desiredDownloadsPath -Force -ErrorAction Stop
}
}
# Update the registry to change the known folder path
Set-ItemProperty -Path $currentRegPath `
-Name "{374DE290-123F-4565-9164-39C4925E467B}" `
-Value $desiredDownloadsPath
# Also update the older 'Shell Folders' for compatibility
$shellFoldersRegPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
if (Test-Path $shellFoldersRegPath) {
Set-ItemProperty -Path $shellFoldersRegPath -Name "Downloads" -Value $desiredDownloadsPath
}
Write-Host "Downloads folder successfully remapped to OneDrive."
# ------------------------------------------------------------
# 4) Indicate success and compliance
# ------------------------------------------------------------
Write-Host "Remediated"
exit 0
}
catch {
Write-Host "An error occurred during remediation: $($_.Exception.Message)"
Write-Host "Not Compliant"
exit 1
}
How to Actually Use This Thing
- Save the Script
Copy-paste it into a.ps1
file, likeRemediate-DownloadsToOneDrive.ps1
. - Test It Locally
Open PowerShell as your normal user (not admin), run the script, and see if it moves your downloads and updates your registry. Double-check your OneDrive for a newDownloads
folder! - Automate the Fun
- Using Intune? Upload the script under Devices > Scripts, and choose “Run script as signed-in user.”
- If you prefer Group Policy or another deployment method, just make sure it runs in the user context.
- Sit back and watch the magic happen on all your devices.

- Enjoy Worry-Free Device Wipes
Next time you reset a PC, you can skip the “Is that file important?” crisis. OneDrive’s got you covered.
Final Thoughts
Yes, your Downloads folder might still be a dumpster—but now it’s a cloud-synced dumpster! You won’t accidentally lose those random files that might (or might not) be crucial. Setting this up takes just a few minutes, but it’ll save you (and your users) from so many “oh no, I forgot my files!” headaches.
Happy downloading, syncing, and stress-free resetting! If you’ve ever lost a precious file in the Great Downloads Abyss, this one’s for you.