Fix NVM and VS Code uninstall failures by retaining elevation - #135
AmirMS (AmelBawa-msft) wants to merge 1 commit into
Conversation
ranm-msft
left a comment
There was a problem hiding this comment.
Reviewed the full diff. Dropping -Unelevated from Remove-DevConfigNvm and from Invoke-DevConfigInnoCleanup is correct: those uninstallers write to machine-scoped locations and to HKLM, so the temporary unelevated task was the thing making them fail. Keeping user-scope WinGet removals on the unelevated path preserves the behaviour that actually needs a user token, so the change is narrowly scoped rather than a blanket elevation.
One thing I deliberately checked: running the Inno uninstaller elevated does not strand per-user state, because the elevated cleanup process runs as the same user, so HKCU and the user profile resolve to the same hive and paths. No orphaned per-user leftovers.
src/tests/calm-os/uninstall-checks.ps1 is a solid harness. Shadowing Test-Path / Get-ChildItem / Get-ItemProperty / Get-AppxPackage / Invoke-DevConfigCleanupCommand keeps it hermetic, and asserting elevation routing, preserved silent args, machine-vs-user scope, the -CheckOnly no-op, the ignored unrelated publisher, and the rejected UninstallString with extra args covers the paths that matter.
No findings. Approving.
No description provided.