When you sign in to a Windows virtual desktop, OneDrive for Business may launch with a Microsoft account instead of your work or school account. This causes sync failures, permission errors, and missing files. The problem occurs because OneDrive caches the last-used sign-in credentials and does not automatically switch accounts when the Windows user profile changes. This article explains why this happens and provides step-by-step fixes to force OneDrive to use the correct organizational account at startup.
Key Takeaways: Force OneDrive to Use the Correct Work Account on Virtual Desktops
- OneDrive Settings > Account > Unlink this PC: Removes cached credentials and forces OneDrive to prompt for the correct account on next startup.
- Registry key HKCU\Software\Microsoft\OneDrive\Accounts\Business1: Stores the tenant ID and sign-in state; deleting this key resets account binding without uninstalling.
- Group Policy Object “Set the maximum size of a user’s OneDrive that can download automatically”: Prevents OneDrive from auto-launching with wrong credentials by disabling Files On-Demand pre-fetch at startup.
Why OneDrive Starts with the Wrong Account on Virtual Desktops
Windows virtual desktop environments such as Azure Virtual Desktop, Windows 365, or VMware Horizon often use pooled or personal session hosts. When a user signs in, the Windows profile may be reused from a previous session. OneDrive for Business stores the last authenticated account in the registry under the current user hive. If the virtual desktop profile is not fully refreshed, OneDrive reads the old account token and tries to sign in with it automatically.
Another cause is the OneDrive startup registry key located at HKCU\Software\Microsoft\Windows\CurrentVersion\Run. This key launches OneDrive.exe with the /background switch. The /background switch tells OneDrive to resume the previous session without showing the sign-in dialog. If the previous session used a personal Microsoft account, the new session inherits that account.
Virtual Desktop Profile Types and Their Effect on OneDrive
FSLogix profile containers and UE-V (User Experience Virtualization) can roam the OneDrive registry keys between sessions. When the profile container loads, it may bring the wrong account token from a different virtual desktop instance. This is common in non-persistent desktop pools where the user profile is stored on a network share.
Steps to Force OneDrive to Use the Correct Work Account
- Unlink OneDrive from the current PC
Right-click the OneDrive cloud icon in the system tray. Select Settings. Go to the Account tab. Click Unlink this PC. In the confirmation dialog, click Unlink account. This removes the cached credentials and stops OneDrive from auto-starting with the wrong account. - Clear the OneDrive account registry keys
Press Windows + R, type regedit, and press Enter. Navigate toHKEY_CURRENT_USER\Software\Microsoft\OneDrive\Accounts. Right-click the Business1 folder and select Delete. If you see a Personal folder, delete that too. Do not delete the root OneDrive key. Close Registry Editor. - Remove the OneDrive startup entry temporarily
Press Ctrl + Shift + Esc to open Task Manager. Click the Startup tab. Find Microsoft OneDrive in the list. Right-click it and select Disable. This prevents OneDrive from launching automatically with the wrong account. - Sign in with the correct work account
Open OneDrive from the Start menu. When the sign-in window appears, enter your work or school email address. Click Sign in. Complete the Microsoft 365 authentication. OneDrive will now sync with the correct tenant. - Re-enable OneDrive startup
Open Task Manager again. Go to the Startup tab. Right-click Microsoft OneDrive and select Enable. OneDrive will now start with the correct account on every virtual desktop session.
If OneDrive Still Starts with the Wrong Account
OneDrive shows “Sign in” prompt every time
This indicates that the registry key deletion did not clear all cached tokens. Run the OneDrive cleanup tool. Open a Command Prompt as administrator. Type "%localappdata%\Microsoft\OneDrive\OneDrive.exe" /reset and press Enter. Wait 30 seconds. OneDrive will restart and show the initial setup screen. Sign in with your work account.
OneDrive launches but syncs an old personal folder
This happens when the virtual desktop profile contains a stale OneDrive folder structure. Move or rename the old OneDrive folder. Open File Explorer. Navigate to %userprofile%\OneDrive. Right-click the folder and select Rename. Add “-old” to the end. Then repeat the steps to sign in with the correct work account. OneDrive will create a new folder.
Group Policy prevents unlinking OneDrive
If your organization blocks unlinking OneDrive through Group Policy, you cannot use the Settings dialog. Use the registry method instead. Delete the Business1 key under HKCU\Software\Microsoft\OneDrive\Accounts. Then restart the OneDrive process from Task Manager. OneDrive will prompt for a new sign-in.
Manual Account Switch vs Registry Reset: Key Differences
| Item | Manual Unlink via Settings | Registry Key Deletion |
|---|---|---|
| Method | OneDrive Settings > Account > Unlink this PC | Delete HKCU\…\Accounts\Business1 key |
| Requires admin rights | No | No, only HKCU access |
| Works with Group Policy blocking | No | Yes |
| Clears cached tokens | Yes | Yes |
| Affects other Microsoft apps | No | No, only OneDrive account binding |
The registry key deletion method is faster and bypasses Group Policy restrictions. The manual unlink method is safer for users who are not comfortable editing the registry. Use the registry method when you need to reset the account without restarting the OneDrive process.
You can now force OneDrive for Business to start with the correct work account on any Windows virtual desktop. Next time you sign in, check the system tray to confirm the account name matches your work email. To prevent future mismatches, configure a login script that deletes the Business1 registry key before OneDrive launches. This ensures a clean account state every session.