How to Automate the OneDrive.exe /reset Command for Windows Users
Question details
The user needs to automate the execution of the OneDrive reset command for users experiencing synchronization failures, specifically addressing the issue where system-level scripts fail to correctly resolve the user's %localappdata% path.

- Product
- OneDrive
- Device & OS
- Windows
- Scenario
- Deploying an automated script to reset the OneDrive application across multiple user profiles in an enterprise or networked environment.
- Observed behavior
- System-level automation scripts fail to correctly identify the %localappdata% variable because OneDrive is installed in individual user directories, necessitating a user-context deployment method.
Before deploying automation scripts, ensure you have administrative access to your network deployment tools (such as Group Policy or SCCM) and verify that users' unsynced local files are safely backed up.
Deploy a User-Context Script using Group Policy
Run a batch or PowerShell script within the user context so the %localappdata% path resolves to the actual user's profile rather than the system profile.
Because OneDrive resides in the user's local AppData folder, resetting it via system-level scripts will not work. You must trigger the reset command as the currently logged-on user.
Open a plain text editor like Notepad and type the reset command: %localappdata%\Microsoft\OneDrive\onedrive.exe /reset
Save the document as a batch file (e.g., ResetOneDrive.bat) or a PowerShell script (e.g., ResetOneDrive.ps1) in a shared network location accessible to all users.
Launch the Group Policy Management Console (GPMC.msc) and create a new Group Policy Object (GPO) linked to the appropriate organizational unit.
Navigate to User Configuration > Policies > Windows Settings > Scripts (Logon/Logoff) and add your created script to run at Logon.

Consult Microsoft Q&A for Advanced Enterprise Scenarios
If you require advanced parameters, SCCM deployment configurations, or SharePoint integrations, consult Microsoft experts.
Looking for a reliable Office suite with built-in cloud sync?
If you frequently encounter synchronization or deployment issues with Microsoft OneDrive, consider trying WPS Office. It provides a lightweight, seamless document editing experience with its own reliable built-in cloud storage and high compatibility with all major document formats.

Frequently Asked Questions
Why does %localappdata% fail in system-level OneDrive reset scripts?
When a script runs at the system level (such as via a system account in SCCM or RMM tools), the %localappdata% environment variable resolves to the system profile's AppData folder instead of the currently logged-in user's folder. Since OneDrive is installed per user, the system cannot find the executable.
What is the standard command to reset OneDrive manually?
To reset OneDrive manually, you can open the Run dialog (Windows Key + R) and enter the following command: %localappdata%\Microsoft\OneDrive\onedrive.exe /reset. This will restart the sync engine.
Will running the OneDrive reset command delete my local files?
No, running the reset command does not delete your files. It only resets the application settings and forces a full re-sync of your data to ensure everything is properly aligned between the cloud and your local machine.




