Skip to content

fix: Edge/OneDrive Remover says whether OneDrive is installed, reaches Edge's update tasks, and undoes failed changes - #2922

Merged
laurentiu021 merged 1 commit into
mainfrom
fix/edge-onedrive-says-what-is-installed
Oct 21, 2026
Merged

laurentiu021 merged 1 commit into
mainfrom
fix/edge-onedrive-says-what-is-installed

Conversation

@laurentiu021

Copy link
Copy Markdown
Owner

Closes #2810.

The tab decided "installed" from OneDrive's setup file, never reached Edge's update tasks, and two changes that failed still changed something.

  • "Installed" is OneDrive.exe. OneDriveInstalled was ResolveOneDriveSetup() is not null, and the System32 copy of the setup survives an uninstall, so after a removal that worked the card said "OneDrive is installed." and Remove stayed on offer. IsOneDriveClientInstalled looks for %LOCALAPPDATA%\Microsoft\OneDrive\OneDrive.exe and for Microsoft OneDrive\OneDrive.exe under Program Files and Program Files (x86); ResolveOneDriveSetup now only finds the program to run. Remove is not applicable without OneDrive.exe. When OneDrive is installed but no setup is found, it fails and launches nothing, instead of saying OneDrive is not installed.
  • "Checking…" until the first read. The four flags start false, so the card said "OneDrive is not installed." while the read was still running. StatusRead turns true in Apply. Until then each card reads "Checking OneDrive…" or "Checking Microsoft Edge…", and if that first read fails, that the state could not be read. The two "not installed, nothing to do" shortcuts apply only once the state is known.
  • Edge's update tasks by prefix. On my PC Edge Update registers MicrosoftEdgeUpdateTaskMachineCore{7A6CBB87-…} and MicrosoftEdgeUpdateTaskMachineUA{A505C5E6-…}, and -TaskName with the bare names matched neither, with the error suppressed, so Disable and Restore returned Success and changed no task. Both scripts now ask Get-ScheduledTask -TaskName 'MicrosoftEdgeUpdateTaskMachineCore*','MicrosoftEdgeUpdateTaskMachineUA*' and keep the ones in the root folder. A wildcard name that matches nothing returns nothing without an error; beside -TaskPath '\' the same query throws, so the folder is filtered after. The change script skips a task already as asked, puts back the ones it changed when one refuses, and reports Found and Refused. The service treats none found or a refusal as not done. The status query counts any task that is not Disabled as enabled, where it counted only Ready.
  • A failed Disable puts the policies back. DisableEdgeAsync reads both values before writing them. When the tasks are not done, or the run throws, a finally writes each value back with its own registry type, or deletes it if it was not set before. It does not use TrySetEdgeBackgroundDisabled(false), which the issue suggested, because that deletes a value set before the change, by an earlier Disable or by whoever manages the PC.
  • A failed Remove OneDrive leaves the File Explorer entry. The unpin now comes only after exit 0, as Restore's pin already did ([Bug]: Edge & OneDrive — Restore OneDrive reports success without checking its setup's exit code #2443). OneDrive is closed before the uninstaller runs, and a failed removal leaves it closed, so the status now adds that it was closed for the attempt and can be opened from the Start menu. SysManager does not start it again itself: OneDrive refuses to run with administrator rights, which SysManager may have, and a OneDrive started through the PowerShell helper can be ended along with the helper's process tree when the helper is released.

A Restore Edge that fails still leaves its policies cleared, as before. That is the direction of the Windows defaults, and the card shows what is left.

Docs

README: the OneDrive and Edge bullets say what the card reads and what a failed change leaves behind. ARCHITECTURE: EdgeOneDriveService's entry.

Tests

  • EdgeOneDriveServiceTests (11 new cases): with the setup present and no OneDrive.exe the status reads not installed, and with OneDrive.exe installed; Remove with no OneDrive is not applicable, and with no setup fails, both launching nothing; a failed uninstall leaves the pin at 1 and a successful one sets it to 0; Disable with none found, with a refusal, with no report and with a run that throws returns Failed with both policies back, and a value set before the change is put back rather than deleted; Restore with none found or a refusal returns Failed. The two task tests now assert that each change runs the builder's own script.
  • EdgeOneDriveViewModelTests (4 new cases): both cards read "Checking…" while the read is pending and the state after it; a failed first read says the state could not be read; a failed removal adds the note only when OneDrive had been running.
  • New EdgeOneDriveScriptTests (integration, 8 cases) runs both scripts in Windows PowerShell 5.1 with the three cmdlets shadowed by stubs that match names as Get-ScheduledTask does: tasks with the ID in their names are found and changed, a task with the same prefix in another folder is left alone, a task already as asked is skipped, a refusal puts back the one changed, none found reports 0 without stopping, a failed read stops the script, and the status query's answer.
  • Red before the fix, green after, each undone on its own: the old scripts (7 script tests and both builder tests fail), "installed" from the setup (2), Remove without the OneDrive.exe check (1), the unpin before the exit check (1), no put-back (5), put-back by deleting (1), none found counted as done (3), the cards naming a state before a read (2), and no note (1).
  • Run locally, twice: EdgeOneDriveServiceTests, EdgeOneDriveViewModelTests, ArchitectureTests and InclusiveTermsTests (300), and the four script test classes (29). All four projects build with 0 warnings, and dotnet format --verify-no-changes is clean.
  • On my PC, the status read through the real PowerShell runner from a small console app now reports both Edge tasks as enabled, where it always read false, and OneDrive as installed from its Program Files copy.

…s Edge's update tasks, and undoes failed changes

- "Installed" is OneDrive.exe under LOCALAPPDATA or Program Files, not the setup Windows keeps in System32, and the
  cards read "Checking…" until the first read, or that the state could not be read.
- Edge's update tasks are found by their name prefixes in the root task folder. The scripts report what they found
  and whether one refused, put back what they changed, and none found counts as not done.
- A failed Disable Edge puts both policy values back as they were, and a failed Remove OneDrive leaves the File
  Explorer entry and says OneDrive was closed for the attempt.
@laurentiu021
laurentiu021 merged commit 0cea10a into main Oct 21, 2026
6 checks passed
@laurentiu021
laurentiu021 deleted the fix/edge-onedrive-says-what-is-installed branch October 21, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant