Repository navigation
Never delete an account during a simulation - #31
Merged
Merged
Conversation
manageusers --simulate removed local accounts that have no profile: the orphan path called the account deletion directly and never checked the mode, so a dry run deleted real accounts. It now audits what it would remove and leaves them, and the account deletion itself refuses to run during a simulation, whichever path reaches it. Adds a test project with regression tests for the orphan path and the ordinary account path, plus a live-mode control.
This was referenced Oct 6, 2026
A simulation wrote the hidden-accounts list under Winlogon\SpecialAccounts\UserList, hiding excluded accounts from the sign-in screen. It now logs which accounts it would hide and writes nothing. Adds a test against a key under HKCU, with a live control.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A simulation is meant to change nothing, but it did two things:
manageusers --simulatedeleted local accounts that have no profile.RemoveOrphanedUsersdeleted the account directly and never checked simulate mode, so a dry run removed real accounts. Every other deletion path already checked the mode.Fix
ORPHAN_USER_REMOVE_SIMULATEDand leaves the account in place.UpdateHiddenUsersno longer writesWinlogon\SpecialAccounts\UserListduring a simulation. It logsSIMULATE: would hide <account> from the sign-in screeninstead.Tests
New
tests/ManageUsers.Tests(xUnit). It uses two small test seams: an injectable command runner and a log constructor that writes to a temp folder.net user "<name>" /delete.dotnet test tests/ManageUsers.Tests: 5 passed.#29 and its stacked #30 will be rebased onto this.