Skip to content

Fixes from the VM test pass: HKCU elevation, standard users, Windows Update presets, Restore All - #20

Merged
PrimeBuild-pc merged 7 commits into
mainfrom
fix/vm-test-findings
Oct 14, 2026
Merged

PrimeBuild-pc merged 7 commits into
mainfrom
fix/vm-test-findings

Conversation

@PrimeBuild-pc

Copy link
Copy Markdown
Owner

Fixes for the bugs found while running the pending VM tests (Windows 11 Pro 26200 Hyper-V VM, administrator account and a standard account). Every fix was retested in the VM after the change.

Bugs fixed

Windows Update presets wiped registry keys (Scripts/WindowsUpdatePreset.ps1)
Set-Policy called New-Item -Force before each value. In Windows PowerShell 5.1 this deletes an existing key's values and subkeys. As a result:

  • each preset kept only the last value it set in each key. Security left AUOptions, ExcludeWUDriversInQualityUpdate and DeferFeatureUpdates unset and was detected as Custom;
  • Disabled lost NoAutoUpdate;
  • any other Windows Update policy was erased, WSUS settings included.

The "Remove Windows AI" built-in script did the same to HKLM\...\Policies\Explorer. Keys are now created only when missing. A new test runs Set-Policy twice on an HKCU key: before the fix only Second survived.

HKCU policy tweaks failed (RegistryService)
HKCU\Software\Policies is read-only for the user, so Remove Bing web results and Disable Notifications and Calendar always failed without asking for UAC. Those keys now elevate.

Standard users: changes landed in the administrator's profile

  • Elevated reg scripts now write HKCU as HKEY_USERS\<SID>. Without this, a mixed HKLM+HKCU tweak run by a standard user wrote the HKCU part into the administrator's hive.
  • Restart as administrator (Apply Recommended, Restore All, playbooks) started TweakHub as the administrator account, so every HKCU tweak went to the administrator's profile. It is now offered only to administrator accounts (limited token), where elevation keeps the same user.
  • Temporary Files Cleanup cleaned the administrator's temp folder instead of the user's. The path now comes from TweakHub's own process.

Restore All

  • It restored single tweaks before the Windows Update preset. Two of them share values with the preset, so the preset lost its backups and failed, leaving DeferFeatureUpdatesPeriodInDays set. The preset is now restored first.
  • The button stayed disabled after reopening TweakHub with backups from an earlier session, for example after the restart a tweak asks for.

Create from this PC
It added Maximum CPU performance and Core parking steps after the power plan step. Those ran on the recreated plan and overwrote the captured values: a 5% minimum came back as 100%. Power tweaks are now skipped when the plan is captured.

Smaller fixes

  • The flip tweak showed as partly applied when untouched, and post-restart verification reported a clean restore as Partial: its GameDVR targets are Windows defaults. A group now counts as partial only when TweakHub still keeps a backup for it.
  • The DNS card used the adapter list read when the page opened, so an adapter connected later was skipped.
  • The high-risk warning also appeared when turning a tweak off.
  • The restart notice said "shown once per session", but Tweak check, Interrupts and Security show it on every change.

Tested in the VM

All passing after the fixes:

  • apply and restore of the new tweaks: telemetry, suggested content, Bing, End task, Fast Startup, BSOD details, AI policies, background update limit, mouse acceleration, flip model (other DirectX entries kept, OverlayTestMode untouched);
  • Tweak check: minimum processor state flagged, repaired to 100, editor range 0–100% and CPU tweak working after a restart, Undo back to 0; the Mpo repair stays undoable after toggling the flip tweak;
  • power plans: activate, duplicate, rename, export, delete, import, editor apply;
  • playbooks: power plan step with a missing plan recreated with its GUID, a second run updates the same plan, --run-playbook elevated restart with one UAC prompt;
  • standard user: mixed tweak writes their own hive, declined UAC leaves the tweak off with no backup, CPU throttling across Balanced and Power saver with no UAC prompt, Apply Recommended and Restore All (SysMain and Prefetch untouched), Security preset and restore;
  • DNS: two adapters, the second connected later, restore to the original static and automatic servers;
  • Marius Heier scripts: warning the first time only, elevated window starts, temporary file deleted;
  • Security: AbuseIPDB button only on public IPs, MalwareBazaar with the SHA-256 only;
  • unsupported network adapter (Hyper-V): preset switch disabled with the reason;
  • v1.4.2 portable copy imported: its AI policies show as partial, Restore All restores everything.

Not tested: needs physical hardware or was skipped

  • HAGS after a restart: no GPU in the VM;
  • network preset on Intel or Realtek adapters;
  • Connections tab: NVIDIA, Radeon, Intel chipsets;
  • Windows in Italian. Not run: every power read goes through powrprof, and bcdedit and AutoTuning checks compare English key names or enums.

Build: 0 warnings. Tests: 249/249.

… VM tests

- HKCU\Software\Policies is read-only for the user, so Bing and Notifications
  tweaks failed without asking for UAC. Those keys now elevate, and elevated
  scripts write HKCU as HKEY_USERS\<SID> so a standard user who types an
  administrator password changes their own hive, not the administrator's.
- Create from this PC skips every power tweak when it captures the plan: they
  ran after the plan step and overwrote its values (a 5% minimum came back as 100%).
- The high-risk warning shows only when applying a tweak, not when restoring it.
- The restart notice no longer says it is shown once per session: Tweak check,
  interrupts and security show it for each change.
… with the Windows Update preset

- A standard user who chose "Restart as administrator" got TweakHub running as
  the administrator account: Apply Recommended and playbooks then wrote every
  HKCU tweak into the administrator's profile. The single-UAC restart is now
  offered only to administrator accounts, where elevation keeps the same user.
- Restore All restored single tweaks before the Windows Update preset. Two of
  them (driver updates, device metadata) share values with the preset, so the
  preset lost those backups and failed, leaving DeferFeatureUpdatesPeriodInDays
  set. The preset is now restored first.
…presets

In Windows PowerShell, New-Item -Force on an existing registry key deletes the
key's values and subkeys. Set-Policy called it before every value, so each
preset kept only the last value in each key (Security left AUOptions,
ExcludeWUDriversInQualityUpdate and DeferFeatureUpdates unset and was detected
as Custom; Disabled lost NoAutoUpdate) and wiped any other Windows Update
policy, WSUS settings included. The Windows AI removal script did the same to
HKLM\...\Policies\Explorer. Both now create a key only when it is missing.
…session

The button starts disabled and only listened for changes; the backup state is
read during startup, before the page exists, so after reopening TweakHub (for
example after the restart a tweak asks for) Restore All stayed grey until some
tweak was toggled.
The adapter list was read once when the page opened, so an adapter connected
afterwards (Ethernet plugged in while TweakHub was open) was left out.
…les Cleanup

The script runs elevated: for a standard user that is the administrator's
account, so GetTempPath pointed at the administrator's temp folder and the
user's own was left untouched. The path now comes from TweakHub's process.
…ults match

The flip tweak sets three GameDVR values to 0, which is also the Windows
default, so on most PCs it showed as partly applied before ever being used, and
the post-restart check reported a clean restore as Partial. A group now counts
as partial only when TweakHub changed it and still keeps its backup; the network
preset gets the same rule.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@PrimeBuild-pc
PrimeBuild-pc merged commit 2fdf6e8 into main Oct 14, 2026
1 check passed
@PrimeBuild-pc
PrimeBuild-pc deleted the fix/vm-test-findings branch October 14, 2026 08:55
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.

1 participant