Hello! Thank you for reaching out. I am Tin, an independent advisor, and glad to assist you today with this issue. This isn't something you hear for the first time; stubborn OneDrive behavior is quite known during Windows 11 usage. No matter if you remove the connection or uninstall OneDrive or edit registry paths-it will still continue haunting you since OneDrive has some other deep hooks into the Windows user profile system, especially if it has already been set up at the beginning for backing up Desktop/Documents/Pictures. Here are some steps to try to resolve the issue.
Step 1: Thwart the Automatic Reinstallation of OneDrive
Windows will reinstall OneDrive again with feature update or refresh user profile process if OneDrive isn't blocked from reinstalling.
Group Policy Block OneDrive (Pro/Edu/Enterprise):
Run gpedit.msc
Navigate to:
Computer Configuration > Administrative Templates > Windows Components > OneDrive
Enable: Prevent the usage of OneDrive for file storage
Restart your computer.
For those in Windows 11 Home:
Registry makes it.
Do regedit
Locate:
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\OneDrive
If DisableFileSyncNGSC doesn't exist, create it:
Right click in the right pane > New > DWORD (32-bit) Value
Name: DisableFileSyncNGSC
Set value to 1
Boot up again.
Step 2: Repair Shell Folder Redirects
It appears that OneDrive was syncing Desktop / Documents / and all that. And those user folder locations are still pointing to where an unreachable OneDrive stands.
Registry Editor (regedit) should be run.
Go to:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
For each of these keys (if they exist), make sure the correct paths are:
Desktop
Documents
Downloads
Pictures
Music
Videos
Example correct path: shell
%USERPROFILE%\Documents
Close regedit and then reboot your PC.
Step 3: Fix PowerShell $PROFILE
Your PowerShell profile is being redirected to OneDrive, probably because the Documents folder is still pointing to it.
To see where PowerShell thinks $PROFILE is:
Open PowerShell and execute:
powershell
$PROFILE
The result should resemble:
makefile
C:\Users<YourName>\OneDrive\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
To counter it:
Manually create a new folder:
makefile
C:\Users<YourName>\Documents\PowerShell\
Copy or create your profile script:
Microsoft.PowerShell_profile.ps1
Edit the PowerShell shortcut so that it forces use of your custom profile:
Right-click PowerShell > Properties
Then at the Target box, add this:
-NoProfile -Command "if (Test-Path '$env:USERPROFILE\Documents\PowerShell\Microsoft.PowerShell_profile.ps1') { . '$env:USERPROFILE\Documents\PowerShell\Microsoft.PowerShell_profile.ps1' }"
Step 4: Disable OneDrive Startup or Syncing Again
Removing OneDrive app is not enough as it silently reinstalls withupdates. To ensure it is always off:
Open the Task Scheduler (taskschd.msc)
Navigate to:
Task Scheduler Library > Microsoft > Windows > OneDrive
Disable or delete any here present tasks.
Check again for and disable OneDrive startup entries:
Press Ctrl + Shift + Esc > Startup tab > Disable "OneDrive" if it's listed
Step 5: Optional- Remove Any Residual OneDrive Folders
100% sure about no other apps depending on these folders:
Boot to Safe Mode
Delete:
C:\Users<YourName>\OneDrive
Any rags left in OneDrive folders found at %LOCALAPPDATA%, %APPDATA%
Please try these steps and let me know how it goes. If you run into any issues, just reply back with the details.
Best regards,
Tin