Share via

Windows keeps creating a OneDrive folder periodically despite trying everything to rid my PC of OneDrive. How do I stop this behaviour for good?

Anonymous
2025-06-12T10:52:46+00:00

Hello.
So, I'm on Windows 11, and a couple of months ago I started working with the terminal for some school projects. I noticed that there was this peculiar ..\OneDrive.. path for almost everything I was accessing; I also started getting annoying notifications about how my 5GB storage was up. I decided to 'remove' all the OneDrive dependence that my system had. So,

  1. Backed up all of my files and folders separately on a pendrive
  2. I unlinked my PC from OneDrive settings.
  3. Uninstalled the OneDrive app on my device.
  4. Changed User Shell Folders keys from ..\OneDrive.. to just ....
  5. Deleted everything I could find named '*OneDrive*' on my PC, except for the sys32, and winsxs stuff that I can't override.

After all of this, Windows still seems to create a new OneDrive folder, and forcefully changes my $PROFILE (that I use for PowerShell) to a OneDrive path, and then obviously my user-defined commands and oh-my-posh stops working because there simply isn't a profile.ps1 inside this new OneDrive folder.

I keep deleting the folder, and it keeps spawning again and again. I'm quite frustrated. Thank you for your patience and help!

Windows for home | Windows 11 | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Anonymous
    2025-06-12T12:36:25+00:00

    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

    3 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful