$ show ChrisTitusTech/winutil
WinUtil is a comprehensive Windows system administration utility delivered as a single compiled PowerShell script (winutil.ps1). It provides a WPF graphical interface for installing applications via WinGet and Chocolatey, applying registry and service tweaks, managing Windows features and AppX packages, changing DNS settings, enabling SSH, creating custom Windows 11 ISOs with driver injection, and controlling Windows Update profiles. The architecture is monolithic but modular in source: a build script (Compile.ps1) assembles the final artifact from separate function files, JSON configuration catalogs, and XAML UI definitions. Background work is handled by a job layer built on a runspace pool, with centralized progress reporting, logging, and error handling. The tool supports both interactive GUI mode and headless automation via preset/config files, making it suitable for both manual system optimization and automated deployment scenarios. While primarily an application, it includes data-driven components such as curated application catalogs and registry research encoded in JSON configuration files.
The LLM identified 5 files worth highlighting for reuse:
Core job dispatcher that wraps long-running operations with busy state management, progress bar updates, taskbar overlay, console output, and error aggregation. It enforces a standardized pattern where job bodies do not manage UI state directly, enabling safe parallel execution across runspaces. The function is self-contained and could be extracted as a reusable async job framework for any PowerShell GUI application.
Thread-safe logging function that uses a named mutex to serialize concurrent log writes from multiple runspaces. It supports transcript-aware host path detection, per-runspace error counters, and structured log entries with timestamps. The pattern of using a mutex for cross-runspace log serialization is a reusable solution for any multi-threaded PowerShell application.
Manages the lifecycle of a shared runspace pool with embedded C# helper types (WinUtilRunspaceCleanupV3, WinUtilRunspacePoolCleanup) that use WaitOrTimerCallback for deferred cleanup. It handles graceful shutdown, prevents new work from being submitted during teardown, and ensures all worker runspaces are properly disposed. The pattern of versioned Add-Type C# helpers for thread-pool-based cleanup is a non-obvious technique reusable in any PowerShell project that uses runspaces.
Retrieves and validates registry combo states (e.g., DNS profiles, update modes) with rollback on verification failure. It reads registry values, compares against expected states, and returns a structured result. The pattern of combining registry read, validation, and rollback in a single idempotent function is reusable for any PowerShell tool that manages registry-based configuration profiles.
Standalone Python tool that uses pywinauto and ctypes to capture a WPF window composite for generating README title screens. It demonstrates a non-obvious technique for programmatically capturing WPF window content with proper DPI scaling and window positioning. The tool is fully self-contained with its own pyproject.toml and tests, making it directly reusable for any project needing automated GUI screenshot generation.