Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

UnDrive — your files stay, OneDrive doesn't

Windows 10 and 11  PowerShell 5.1  MIT license

Secure every file on your own disk first — then remove OneDrive for good.
One ~330-line script · stock PowerShell 5.1 · no installer, no dependencies · safe to re-run


Uninstalling OneDrive the normal way does it in the wrong order: cloud-only files are left behind as unopenable stubs, and Desktop / Documents / Pictures keep pointing into a dead OneDrive folder. UnDrive flips the order:

Secure files, then remove OneDrive, then done Secure files, then remove OneDrive, then done

◢ Safety first — in this order

  1. Secure — downloads every cloud-only placeholder (needs internet), then moves everything to C:\Users\<you>\LocalFiles, preserving folder structure, and points Desktop / Documents / Pictures back at your local profile.
  2. Remove — only after step 1 succeeds and you type YES: uninstalls OneDrive, deletes its leftover data folders, removes the Explorer sidebar entry and autostart, and sets the Windows policy that keeps it from coming back.
  3. Report — how many files moved and where, what was removed, and anything skipped so you can follow up.
Moved never deleted, collisions keep both, every delete guarded, removal only on YES Moved never deleted, collisions keep both, every delete guarded, removal only on YES

Your cloud copies stay untouched in your Microsoft account, and the script is safe to re-run — every step checks state first and skips what's already done.


◢ Usage

Grab undrive.ps1 (or git clone https://github.com/alonbaron/UnDrive), then from an elevated PowerShell (right-click → Run as administrator):

powershell -ExecutionPolicy Bypass -File .\undrive.ps1

To preview every action without changing anything:

powershell -ExecutionPolicy Bypass -File .\undrive.ps1 -DryRun
Sample -DryRun output in a terminal window
What exactly gets removed
  • The OneDrive app — OneDriveSetup.exe /uninstall (System32 / SysWOW64), or the per-user uninstaller registered in HKCU if there's no system copy.
  • %LOCALAPPDATA%\Microsoft\OneDrive and %ProgramData%\Microsoft OneDrive — settings, logs, caches. Never user files.
  • Your old OneDrive folder — but only once it is verifiably empty.
  • The Explorer sidebar entry and the autostart (Run key) entry.
  • Sets policy DisableFileSyncNGSC = 1, so Windows never relaunches it.

Warning

Before any manual cleanup, open C:\Users\<you>\LocalFiles and verify your files are all there. UnDrive never deletes user files — don't be the one who does.


◢ Notes

  • Mid-sync detection is a heuristic (Windows exposes no public sync-status API): the script refuses to run if OneDrive is active and files changed in the last two minutes.
  • Verified with -DryRun on Windows 11. The uninstall step uses Microsoft's documented OneDriveSetup.exe /uninstall, but has not been exercised end-to-end on the author's machine — read the final report after a real run.
  • Sign out and back in afterwards so Explorer picks up the folder changes.

◢ License

MIT


Verify C:\Users\<you>\LocalFiles before any manual cleanup.
Secure first. Remove second. Verify always.

About

Remove OneDrive from a Windows PC - files secured first. Your files stay. OneDrive doesn't.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages