OneDrive for Business Windows startup troubleshooting for virtual desktops: uses the wrong account
🔍 WiseChecker

OneDrive for Business Windows startup troubleshooting for virtual desktops: uses the wrong account

When you sign in to a virtual desktop environment such as Windows 365, Azure Virtual Desktop, or VMware Horizon, OneDrive for Business may start with a different Microsoft 365 account than the one you are currently using. This typically happens because the virtual desktop inherits cached credentials from the user profile or from a previous session that was not properly cleaned up. In this article, you will learn why OneDrive picks up the wrong account at startup on virtual desktops and how to force it to use the correct account every time.

Key Takeaways: Fix OneDrive Using the Wrong Account on Virtual Desktops

  • OneDrive Settings > Account > Unlink this PC: Removes the cached account association so OneDrive prompts for the correct sign-in on next startup.
  • Windows Credential Manager > Windows Credentials > Generic Credentials: Delete any OneDrive-related credentials that belong to the wrong account.
  • Group Policy > Administrative Templates > OneDrive > Silently sign in users to the OneDrive sync app with their Windows credentials: When enabled, OneDrive uses the same account as the Windows sign-in, preventing account mismatch in virtual desktop environments.

ADVERTISEMENT

Why OneDrive Starts with the Wrong Account on Virtual Desktops

Virtual desktops often reuse the same user profile disk or roaming profile across sessions. When you sign into a virtual desktop with one Microsoft 365 account, Windows stores the OneDrive authentication token in the Windows Credential Manager and in the OneDrive application cache. If the same profile is later used by a different user or by the same user with a different account, OneDrive loads the previously cached token instead of prompting for a new sign-in.

The OneDrive sync app reads the credential cache at startup before it checks the current Windows user identity. In non-persistent virtual desktop environments, the OS may also apply a default user profile that contains stale OneDrive settings from a golden image or template. The result is that OneDrive appears to sync with an account that does not match the user who is currently signed into Windows.

Common Scenarios That Cause Wrong Account Behavior

Shared virtual desktop pools. When multiple users connect to the same virtual machine, OneDrive may retain the credentials of the first user who set up the sync. Subsequent users see files from the original account.

FSLogix profile containers. If the FSLogix container holds an older OneDrive token, the sync app picks up that token even after the user signs out and back in with a different account.

Group Policy or registry pre-configuration. IT administrators may pre-configure OneDrive with a tenant ID or account hint that does not match the end user’s primary identity.

Steps to Force OneDrive to Use the Correct Account

Follow these steps in order. Each step removes a different layer of cached credentials.

  1. Sign out of OneDrive and unlink the device
    Right-click the OneDrive cloud icon in the system tray. Select Help & Settings > Settings. Go to the Account tab and click Unlink this PC. Confirm the action. This clears the account mapping stored inside the OneDrive application.
  2. Delete stored credentials from Windows Credential Manager
    Open Control Panel > User Accounts > Credential Manager. Click Windows Credentials. Look for entries that contain OneDrive or MicrosoftOffice followed by numbers. Common names include MicrosoftOffice16_Data:ADAL: and OneDrive Cached Credential. Click the arrow to expand each entry, then click Remove. Confirm the deletion.
  3. Clear OneDrive cached tokens in the AppData folder
    Press Windows + R, type %localappdata%\Microsoft\OneDrive\settings, and press Enter. Delete all files and folders inside the settings folder. Do not delete the folder itself. Then navigate to %localappdata%\Microsoft\OneDrive\logs and delete its contents as well. Restart the virtual desktop session.
  4. Restart OneDrive with the correct account
    Open Start, type OneDrive, and press Enter. The setup window appears. Enter the correct Microsoft 365 email address and click Sign in. Complete the authentication flow. OneDrive now syncs with the intended account.
  5. Enable silent account configuration via Group Policy
    If you manage multiple virtual desktops, configure the policy Silently sign in users to the OneDrive sync app with their Windows credentials. This policy is located under Computer Configuration > Administrative Templates > OneDrive. Set it to Enabled. OneDrive then uses the same UPN as the Windows sign-in and ignores any cached token from a previous session.

ADVERTISEMENT

If OneDrive Still Starts with the Wrong Account

OneDrive uses the wrong account after every reboot

This usually means the virtual desktop profile is persistent and retains the old credential cache. After unlinking and clearing credentials, run OneDrive.exe /reset from a command prompt. Wait 30 seconds, then start OneDrive manually. The reset command removes all registration data and forces a fresh setup.

OneDrive shows multiple accounts and syncs the wrong one

Open OneDrive Settings > Account. Click Add an account only if you need multiple accounts. To remove the unwanted account, click the three dots next to that account and select Remove account. Then unlink and re-link the correct account as described in the main steps.

The wrong account appears in a non-persistent VDI environment

Non-persistent virtual desktops discard changes after logoff. The fix must be applied at the image level. Delete all OneDrive cached tokens from the golden image before sealing it. Also apply the Group Policy setting Silently sign in users to the OneDrive sync app with their Windows credentials to the image. This prevents OneDrive from ever storing a stale token in the first place.

Unlink and Re-link vs Credential Manager: When to Use Each Method

Item Unlink and Re-link Credential Manager Deletion
Scope Removes account mapping inside OneDrive only Removes the authentication token stored by Windows
Effectiveness Works when OneDrive is still associated with the wrong account but credentials are correct Required when OneDrive automatically signs in with the wrong account without prompting
User impact User must sign in again after unlinking User must re-enter credentials for all Microsoft 365 apps that used those tokens
Best for Single-user virtual desktops with occasional account mix-up Shared or multi-session virtual desktops where stale credentials persist

You can now force OneDrive to start with the correct account on any virtual desktop. First unlink the device and delete all cached credentials from the Credential Manager and the AppData folder. For managed environments, enable the silent sign-in Group Policy setting to prevent the problem from recurring. As an advanced tip, add a logoff script that runs OneDrive.exe /reset and clears the %localappdata%\Microsoft\OneDrive\settings folder before the user session ends.

ADVERTISEMENT