Windows maintenance automation is deceptively difficult. Running DISM, SFC, or a package-manager command is easy; deciding when to run it, how to recover from partial failure, and how to leave enough evidence for troubleshooting is the harder engineering problem.
I have been working on OneClick-Komplettreparatur, my own open-source PowerShell project for Windows 10 and Windows 11. The project is written in German, but the design questions are universal: how can an administrative maintenance workflow remain inspectable, conservative, and recoverable while it changes operating-system components and installed software?
This article describes the architecture, the safety trade-offs, and the limits of the current 1.0.0 release. It is not a claim that one script can repair every Windows problem.
Start with explicit preconditions
The workflow is intended for supported Windows client installations: Windows 10 from build 17763 and Windows 11, with Windows 11 required on ARM64. It needs administrator rights, an internet connection, access to the user's Documents folder, sufficient free disk space, and an environment without another installer or Windows repair already running.
Before doing useful work, the script validates the platform, architecture, script path, elevation state, and runtime. It verifies PowerShell 7.4 or newer and performs an internal self-test. A Windows restore point is requested when the system supports it, but this is treated as a best-effort guardrail rather than a guarantee.
That distinction matters: administrative automation can reduce risk, but it cannot make operating-system mutation risk-free. Important data should still be backed up before a comprehensive repair run.
Use a staged pipeline instead of a bag of commands
The current workflow is divided into ordered phases:
- Validate Windows, architecture, runtime, path, and administrator state.
- Initialize logging and temporary run directories.
- Run internal self-tests and inspect any saved restart state.
- Check the Windows component store with DISM.
- Repair the component store only when a repairable problem has been detected.
- Run the dependent SFC and CHKDSK checks after a confirmed DISM repair.
- Pause safely when Windows requires a reboot, then resume after the new boot.
- Inventory installed software from the registry and WinGet.
- Verify or repair WinGet and its official default sources.
- Process user-scoped and machine-scoped applications with the appropriate token.
- Isolate individual package failures so one broken installer does not automatically stop every other check.
- Re-check the actions that were performed and produce CSV and text reports.
This structure gives every mutating action a place in a larger state machine. It also makes a severe infrastructure failure different from an isolated third-party package failure.
DISM and SFC are an ordered dependency
A common maintenance script simply runs several repair commands in sequence. This project treats the component store as a dependency. DISM first determines whether damage exists and whether it is repairable. A repair is attempted only when that evidence exists. SFC and CHKDSK-related controls are then reached after a confirmed DISM repair.
The goal is not to maximize the number of commands executed. The goal is to avoid unnecessary mutation and preserve a meaningful explanation of why a later phase ran.
WinGet is both a dependency and a failure boundary
WinGet is used for software discovery and updates, so its own health cannot be assumed. The workflow checks the client and the official default sources before relying on package operations. Network, source, signature, or hash problems cause the affected operation to be skipped, quarantined, or stopped rather than silently accepted.
Installed software is inventoried from both WinGet and the Windows registry. Updates, supported MSI repairs, and selected reinstall paths are processed package by package. A single installer can fail without hiding the result of every unrelated package.
This is important because third-party installers are not uniform APIs. They can launch child processes, wait for UI, return inconsistent exit codes, or become inactive without terminating.
Separate user and machine scope
The main controller needs elevation for system-wide operations, but user-scoped applications should not automatically be manipulated with an administrator identity. The workflow therefore distinguishes between machine-wide work and user-related package work, using a normal user token for the latter.
This does not remove every privilege risk, but it avoids treating elevation as a universal execution mode.
Reboots are persisted state, not an exception
Some Windows repairs are incomplete until restart. When that happens, the script stops further mutating phases, stores a protected continuation state, and registers a scheduled task. The continuation is accepted only when the saved state is valid and a new Windows boot has actually occurred.
This model prevents the script from pretending that a pre-reboot and post-reboot system are the same execution environment. It also provides an explicit exit code (3010) for the reboot-required state.
Observability is part of the feature
Temporary runtime state and final reports are kept in the current user's Windows Documents folder. A completed run can produce a timestamped CSV result file and a text summary. Individual updates, repairs, reinstall attempts, warnings, quarantined items, and failures remain visible instead of collapsing into a single success message.
The public exit-code contract currently distinguishes success (0), fatal or incomplete failure (1), completed-with-warnings (2), and reboot-required (3010).
Timeout and inactivity handling also considers installer processes, child processes, log activity, and downloads. If a process tree exceeds its allowed runtime or is demonstrably inactive, the affected operation can be terminated and recorded.
Preserve the release as an auditable artifact
Version 1.0.0 is intentionally treated as an immutable release snapshot. The full PowerShell source is visible in the repository rather than hidden in an executable. The release asset has a published SHA-256:
c6ed1392cc08d7757359725ae0ed29f9ac5c1ab37ec7d6244957c8aec5b37d86
The hash proves that a downloaded file matches the published asset. It does not prove that the code is safe, and it does not replace source review.
The repository uses the Apache-2.0 license and includes attribution information. GitHub Actions checks repository structure, release protection, licensing files, and PowerShell syntax under Windows PowerShell 5.1 and PowerShell 7. Branch protection requires CI and prevents casual changes to the published snapshot.
CI has an important boundary: it performs static and repository-level checks. It does not run Windows repair operations on a user's computer and cannot prove that every vendor installer or damaged machine will behave correctly.
Current limitations
The largest limitations are environmental:
- Windows installations can already be damaged in ways that prevent normal repair APIs from working.
- Restore-point creation may be disabled or unavailable.
- Third-party installers can have undocumented behavior and inconsistent unattended modes.
- WinGet depends on network access, sources, package metadata, and upstream installers.
- Security software and enterprise policy can block otherwise valid actions.
- A static CI pipeline cannot reproduce real combinations of hardware, policy, pending reboots, and partially installed applications.
- Any script running with administrator rights deserves independent review before execution.
The interface and documentation are currently primarily German, and the 1.0.0 snapshot is deliberately frozen. Fixes and redesigns should appear in a future version rather than silently rewriting the original release.
Feedback I am looking for
I would especially value review from PowerShell users and Windows administrators on these questions:
- Is the DISM/SFC phase ordering conservative enough?
- Are the privilege boundaries between user and machine scope clear?
- What restart-state validation would you add?
- Which installer or WinGet edge cases should be tested first?
- Which operations are too risky to automate and should remain manual?
- What report fields would make a failed run easier to diagnose?
The source, release information, safety notes, and issue tracker are available here:
https://github.com/Skeiver/OneClick-Komplettreparatur-fuer-Windows
The project is open source under Apache-2.0. Technical criticism, safety review, and reproducible bug reports are welcome.
Top comments (0)