Malin Fossum d0d39d6478 Warn instead of logging "tweak completed" after a tweak step error (#5090)
* Warn instead of logging tweak completed after a step error

Invoke-WinUtilTweaks wrote "Apply tweak completed" unconditionally, even
when Invoke-WinUtilScript or another helper had just logged an ERROR for
that tweak. The job layer already counts those errors, so snapshot the
count after the header line and compare at the end: log a WARN line with
the error count when it grew, otherwise the existing completed line.

Two Pester cases run the real logger and script runner against a temp
log file to pin both outcomes.

* Count tweak step errors from the shared log list

The job error counter only increments inside a Start-WinUtilJob worker.
Toggle switches call Invoke-WinUtilTweaks directly on the UI thread, so
a failing toggle still logged "tweak completed" after its ERROR line.

Every ERROR line is added to $sync.LoggedErrors from any runspace, and
Invoke-WinUtilAutoRun already reads it as a before/after delta, so the
tweak runner now does the same. The completion-status tests run without
the worker flag and seed an earlier unrelated error, and a new case
covers a failing UndoScript.

* Count tweak errors on the logging runspace, not the shared list

Diffing $sync.LoggedErrors charged a toggle with errors a concurrent
job logged from its own runspace. Global scope is per runspace, so the
logger now bumps the runspace counter for every headline error and the
tweak status diffs that. Job workers still reset the counter at start
and end, so job results are unchanged.
2026-09-29 10:58:32 -05:00
2024-08-30 09:48:21 -05:00
2026-09-26 10:32:30 -05:00
2025-05-23 11:26:48 -05:00

Chris Titus Tech's Windows Utility

Version Downloads Discord

A curated compilation of Windows system tasks streamline installs, debloat with tweaks, troubleshoot with config, and configure Windows updates. Run it fresh on every new Windows install.

Title Screen


Quick Start

WinUtil must be run as Administrator because it performs system-wide changes.

Open PowerShell or Terminal as admin, then run:

Stable Branch (recommended)

irm https://christitus.com/win | iex

Development Branch

irm https://christitus.com/windev | iex

How to open an admin terminal

  • Start menu: Right-click Start → Windows PowerShell (Admin) or Terminal (Admin)
  • Search: Press the Windows key, and type PowerShell or Terminal, then Ctrl + Shift + Enter

Automation / Presets

Apply a predefined configuration without manual selection:

& ([ScriptBlock]::Create((irm https://christitus.com/win))) -Preset Standard
Preset Description
Standard Balanced defaults for most users
Minimal Minimal changes to suit every user
Advanced Deep tweaks for power users

To view exactly what each preset does, see: https://github.com/ChrisTitusTech/winutil/blob/main/config/preset.json


Build & Develop

See https://github.com/ChrisTitusTech/winutil/blob/main/.github/CONTRIBUTING.md


Resources


Support

Sponsors

These are the sponsors that help keep this project alive with monthly contributions.

User avatar: User avatar: MartinUser avatar: Jason A. DiegmuellerUser avatar: RMSUser avatar: PaulUser avatar: Dave J  (WhamGeek)User avatar: Anthony MendezUser avatar: User avatar: DursleyGuyUser avatar: User avatar: Kiera MeredithUser avatar: Sean (ANGRYxScotsman)User avatar: Fra · ppeUser avatar: José Encarnação

*Sponsors with a recurring subscription also get access to the .NET alternative.


Contributors

Contributors

Thanks to everyone who has contributed time and effort to this project. Keep rocking 🍻

S
Description
Mirror of winutil
Readme MIT
41 MiB
Languages
PowerShell 96.4%
Python 3.6%