2026-02-10 19:49:36 +00:00
---
title : "Remove OneDrive"
description : ""
---
2026-02-18 12:37:09 -06:00
2026-03-31 10:33:09 -05:00
```json {filename="config/tweaks.json",linenos=inline,linenostart=1481}
2026-01-27 21:24:17 +02:00
"WPFTweaksRemoveOneDrive": {
"Content": "Remove OneDrive",
2026-03-02 13:08:27 -06:00
"Description": "Denies permission to remove OneDrive user files, then uses its own uninstaller to remove it and restores the original permission afterward.",
2026-01-27 21:24:17 +02:00
"category": "z__Advanced Tweaks - CAUTION",
"panel": "1",
"InvokeScript": [
"
# Deny permission to remove OneDrive folder
icacls $Env:OneDrive /deny \"Administrators:(D,DC)\"
Write-Host \"Uninstalling OneDrive...\"
Start-Process 'C:\\Windows\\System32\\OneDriveSetup.exe' -ArgumentList '/uninstall' -Wait
2026-02-06 10:26:29 -06:00
2026-01-27 21:24:17 +02:00
# Some of OneDrive files use explorer, and OneDrive uses FileCoAuth
Write-Host \"Removing leftover OneDrive Files...\"
Stop-Process -Name FileCoAuth,Explorer
Remove-Item \"$Env:LocalAppData\\Microsoft\\OneDrive\" -Recurse -Force
Remove-Item \"C:\\ProgramData\\Microsoft OneDrive\" -Recurse -Force
2026-03-26 15:26:48 -05:00
# Grant back permission to access OneDrive folder
2026-01-27 21:24:17 +02:00
icacls $Env:OneDrive /grant \"Administrators:(D,DC)\"
2026-02-10 22:22:32 +02:00
# Disable OneSyncSvc
Set-Service -Name OneSyncSvc -StartupType Disabled
2026-01-27 21:24:17 +02:00
"
],
"UndoScript": [
"
Write-Host \"Installing OneDrive\"
winget install Microsoft.Onedrive --source winget
2026-02-10 22:22:32 +02:00
# Enabled OneSyncSvc
2026-03-19 23:29:25 -05:00
Set-Service -Name OneSyncSvc -StartupType Automatic
2026-01-27 21:24:17 +02:00
"
],
` ``