diff --git a/config/tweaks.json b/config/tweaks.json index 285e877b..f5d580b1 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -667,13 +667,20 @@ # 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 # Grant back permission to access OneDrive folder icacls $Env:OneDrive /grant \"Administrators:(D,DC)\" + if (-not (Get-ChildItem -Path $Env:OneDrive)) { + Remove-Item -Path $Env:OneDrive + [Environment]::SetEnvironmentVariable('OneDrive', $null, 'User') + } + # Disable OneSyncSvc Set-Service -Name OneSyncSvc -StartupType Disabled "