Skip to content

feat: backup, rollback и remote user fixes / backup, rollback and remote user repairs - #2

Merged
OneDeadMachine-Dev merged 3 commits into
mainfrom
odm/system-state-backup
Aug 14, 2026
Merged

feat: backup, rollback и remote user fixes / backup, rollback and remote user repairs#2
OneDeadMachine-Dev merged 3 commits into
mainfrom
odm/system-state-backup

Conversation

@OneDeadMachine-Dev

@OneDeadMachine-Dev OneDeadMachine-Dev commented Aug 14, 2026

Copy link
Copy Markdown
Owner

???????

??? ??????????

???????? backup ? ?????

  • ????? ?????? ?????????? ????????? ??????????? ?????? ????????????? ????????, ??????? ? ACL ???????.
  • ?????? ???????? state.clixml, manifest.json, ??????????? .reg-????? ? ?????????? restore.ps1 ? %ProgramData%\W-Fix\Backups.
  • ? ????????? ????????? ??????? ??????? ??? ?????????????? ?????????? ????????? ?????? ?? ??? ?? ????????? ??? ????????? ??????.
  • ?????? ???????? ?????? ???? ????????????, ?? ?? ????????? ??? ??????: W-Fix ???????? ???????? ????????.

????????? ???????????????? ???????? ?? ????????? ??

  • 0x00000709 ? ?????? ???????? ?? ????????? ?????? ?? ????????? ???????????????? ???????? ? HKCU WinRM-??????????????.
  • W-Fix ?????????? ????????? ???????????? ? ????????? ??? ?????? ????? HKEY_USERS\<SID>; ????? ???????? ? ???? ?? ???????.
  • WScript.Network, PrintUI ? ???????? default-???????? ??????????? ????????????? ??????? Task Scheduler ? LogonType=Interactive ? RunLevel=Limited, ??? ??????? ??? ?????????? ?????? ????????????.
  • ACL ????????????????? ??????? ? ?????????? Spooler ???????? ? ???????????????? WinRM-?????????.
  • ????????? ???????, ???????? exit code ? [ERROR], UTF-8 ??????, ??????? ????????? ??????/?????? ? ?????????????? ??????? ??? ??????.
  • ??? ?????????? ?????????????? ???????????? ???????? ?????? ?????? ??????????? ???????.
  • rundll32 ??????????? ?? exit code, ? ????? ?????????? ?????????????? ??????????? default-?????????.
  • ????? ??? ?????????? ???????? ????????????? ??????? Device ? UserSelectedDefault ? ??????????? ?????????.

?????????? UI ? CI

  • ???? ???????? ??????????? ? ?????? ???????, ??????? ????? ?????? ?? ?????????????? ????????????? ????????.
  • ????????? ????? ?????????? ?????????, ???????? ? ?????? AD; ??????? ?????????? ??????????.
  • GitHub Actions ????????? ?? checkout@v7 ? setup-dotnet@v6.
  • README ? ????????????? ???????????? ???????????????? ? ???????????.

??????

WinRM ????????? PowerShell ? ????????? ????????? ??????????????. ??? per-user ???????? ?????? ??? ???????? ???????????? HKCU ? ????????????? ??????? ??????? ???????????????? COM/PrintUI ????????. ???? ????????? ???????????????? ? ???????????????? ????, ????????? ??????????? ??????? ? ????????? ???????? ????????? ?????? ??????? ? ????? ??????? ???????.

????????

  • dotnet test W-Fix.sln -c Release --no-restore ? 17/17
  • Release build ? 0 ??????????????, 0 ??????
  • Self-contained single-file publish ??? win-x64 ? ???????
  • PowerShell Parser ????????? ??????????????? backup ? interactive-task ????????
  • NuGet vulnerability report ? ???????? ?????? ???????????
  • git diff --check ? ???????

English

What changed

Targeted backup and rollback

  • Six system-changing fixers now snapshot only the registry values, keys, and ACLs they affect.
  • Each snapshot contains state.clixml, manifest.json, required .reg exports, and a standalone restore.ps1 under %ProgramData%\W-Fix\Backups.
  • Added an Undo command that restores the latest successful snapshot on the same local or remote machine.
  • Snapshot failures are clearly reported but do not block the repair, keeping W-Fix an active fixer.

Real remote interactive-user context

  • The 0x00000709 and default-printer fixers no longer run per-user work against the WinRM administrator's HKCU.
  • W-Fix resolves the logged-on user and snapshots that profile through HKEY_USERS\<SID>; rollback remains bound to the same profile.
  • WScript.Network, PrintUI, and default-printer verification run through a short-lived Task Scheduler job using LogonType=Interactive and RunLevel=Limited, without requesting or storing the user's password.
  • User-hive ACL repair and Spooler restart remain in the administrative WinRM context.
  • Added execution timeout, exit-code and [ERROR] validation, UTF-8 output capture, temporary task/file cleanup, and cancellation cleanup.
  • A missing interactive user now produces an explicit failure instead of a false success.
  • rundll32 exit codes and the actual resulting default printer are verified.
  • Resetting without a selected printer now removes and verifies Device and UserSelectedDefault.

UI and CI reliability

  • The operation target is captured at start, preventing selection changes from redirecting in-flight repairs.
  • Removed stale-result races in printer refresh, print queues, and AD search; background exceptions are observed.
  • Updated GitHub Actions to checkout@v7 and setup-dotnet@v6.
  • Synchronized README and architecture documentation with the implementation.

Why

WinRM runs PowerShell in an administrator service context. For per-user printing settings this means the wrong HKCU and no reliable access to the user's COM/PrintUI session. This patch separates administrative and interactive-user steps, preserves registry reversibility, and validates the actual result instead of trusting command invocation alone.

Validation

  • dotnet test W-Fix.sln -c Release --no-restore ? 17/17 passed
  • Release build ? 0 warnings, 0 errors
  • Self-contained single-file win-x64 publish ? passed
  • Generated backup and interactive-task scripts validated by the PowerShell Parser
  • NuGet vulnerability report ? no vulnerable packages
  • git diff --check ? passed

@OneDeadMachine-Dev OneDeadMachine-Dev changed the title feat: точечный backup и откат / targeted system-state backup and rollback feat: backup, rollback и remote user fixes / backup, rollback and remote user repairs Aug 14, 2026
@OneDeadMachine-Dev
OneDeadMachine-Dev marked this pull request as ready for review August 14, 2026 06:50
@OneDeadMachine-Dev
OneDeadMachine-Dev merged commit 809502d into main Aug 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants