Skip to content

crisbbc/onebgoner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

onebgoner

A PowerShell script that migrates OneDrive-redirected folders back to their local counterparts and completely removes OneDrive from Windows.

What it does

  1. Detects the OneDrive root folder ($env:OneDrive or %USERPROFILE%\OneDrive).
  2. Moves all files and sub-folders from each OneDrive-hosted known folder to its local equivalent:
    OneDrive path Local path
    …\OneDrive\Desktop ~\Desktop
    …\OneDrive\Documents ~\Documents
    …\OneDrive\Downloads ~\Downloads
    …\OneDrive\Pictures ~\Pictures
    …\OneDrive\Music ~\Music
    …\OneDrive\Videos ~\Videos
  3. Resets Windows Shell Folder registry keys so that all apps point to the local paths again (uses both registry values and SHSetKnownFolderPath).
  4. Stops all OneDrive processes (OneDrive.exe, OneDriveStandaloneUpdater.exe).
  5. Uninstalls OneDrive via its own setup executable (/uninstall).
  6. Deletes leftover OneDrive program files and the (now-empty) OneDrive data folder.
  7. Cleans up OneDrive registry entries and startup entries.
  8. Removes OneDrive from the Windows Explorer navigation pane.

Requirements

  • Windows 10 or Windows 11
  • PowerShell 5.1 or later
  • Administrator privileges (the script will refuse to run without them)

Usage

Open an elevated PowerShell prompt (Run as Administrator) and run:

# Run the full migration and removal
.\Remove-OneDrive.ps1

# Preview all actions without making any changes (dry-run)
.\Remove-OneDrive.ps1 -WhatIf

# Override the OneDrive path if it is in a non-standard location
.\Remove-OneDrive.ps1 -OneDrivePath "D:\OneDrive"

Tip: A reboot (or at minimum a restart of Windows Explorer) is recommended after running the script so that all shell folder changes take full effect.

Notes

  • Files that already exist in the destination folder are skipped (not overwritten) to avoid accidental data loss.
  • The script uses PowerShell's built-in -WhatIf support, so every destructive operation respects the -WhatIf flag.
  • If OneDrive is already uninstalled, the script gracefully skips the uninstallation step.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors