404 FORUM

Community Discussion Terminal

Score
0

Chris Titus winutil that does AMAZING things for Windows

Windows-sin-evil-bad devil-horns. One drive moreso.

1461

"WPFTweaksRemoveOneDrive": {

1462

"Content": "Remove OneDrive",

1463

"Description": "Denies permission to remove OneDrive user files, then uses its own uninstaller to remove it and restores the original permission afterward.",

1464

"category": "z__Advanced Tweaks - CAUTION",

1465

"panel": "1",

1466

"InvokeScript": [

1467

"

1468

# Deny permission to remove OneDrive folder

1469

icacls $Env:OneDrive /deny \"Administrators:(D,DC)\"

1470

1471

Write-Host \"Uninstalling OneDrive...\"

1472

Start-Process 'C:\\Windows\\System32\\OneDriveSetup.exe' -ArgumentList '/uninstall' -Wait

1473

1474

# Some of OneDrive files use explorer, and OneDrive uses FileCoAuth

1475

Write-Host \"Removing leftover OneDrive Files...\"

1476

Stop-Process -Name FileCoAuth,Explorer

1477

Remove-Item \"$Env:LocalAppData\\Microsoft\\OneDrive\" -Recurse -Force

1478

Remove-Item \"C:\\ProgramData\\Microsoft OneDrive\" -Recurse -Force

1479

1480

# Grant back permission to accses OneDrive folder

1481

icacls $Env:OneDrive /grant \"Administrators:(D,DC)\"

1482

1483

# Disable OneSyncSvc

1484

Set-Service -Name OneSyncSvc -StartupType Disabled

1485

"

1486

],

1487

"UndoScript": [

1488

"

1489

Write-Host \"Installing OneDrive\"

1490

winget install Microsoft.Onedrive --source winget

1491

1492

# Enabled OneSyncSvc

1493

Set-Service -Name OneSyncSvc -StartupType Enabled

1494

"

1495

],

U
By Fox Mulder
🕒 Mar 5, 2026 07:39
💬 0 replies

💬 Join the Discussion

Login to reply to this post and share your thoughts!

🔐 Login

💬 Replies (0 total)

No replies yet

Be the first to reply to this post!