Skip to content

About

A diagnostic and remediation PowerShell tool to fix the Winget execution loop on Windows 11.

Topics

Resources

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

Winget Diagnostic & Remediation Tool

Quick Start | Safety Standards | Microsoft Intune Guide | SCCM & MDT Guide | Extended Docs | Testing Suite | Use Cases & Causes

Lint State Production Release Pipeline License: MIT

A safe, single-profile utility engineered to diagnose and repair corrupted Windows Package Manager (winget) execution aliases, broken NTFS reparse points, and asymmetrical profile registry inconsistencies on Windows 11.

⚡ What It Fixes (The 5-Second Rule)

  • The "Open With" Loop: Permanently breaks out of the loop where running winget repeatedly prompts the user to select a GUI handler app.
  • Mangled Reparse Points: Forcefully purges corrupted execution alias files in %USERPROFILE%\AppData\Local\Microsoft\WindowsApps that standard shell commands fail to delete.
  • Elevation Profile Mismatches: Corrects registry PATH variables within the active user's environment block, even when executed from an elevated administrative context.

🚀 Quick Start (Copy & Paste)

To evaluate your system state and interactively apply fixes, execute the following command block from a native Windows PowerShell or PowerShell Core console:

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
& ([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing '[https://raw.githubusercontent.com/aj1126/winget-diagnostic-tool/main/Repair-WingetAlias.ps1').Content](https://raw.githubusercontent.com/aj1126/winget-diagnostic-tool/main/Repair-WingetAlias.ps1').Content)))

Unattended Enterprise Automation (RMM/Intune/MDT)

For headless deployment image scrubbing or silent profile repairs, append the -Force switch:

.\Repair-WingetAlias.ps1 -Force

Microsoft Intune Proactive Remediations

For native Intune deployment with single-file IME isolation and zero external dependencies, upload the standalone scripts located in the intune/ directory:

Microsoft SCCM / MECM & MDT Task Sequences

For OSD imaging pipelines, Active Setup staging, or Configuration Baselines, consult the dedicated deployment runbook in the sccm/ directory:

  • Active Setup Staging: sccm/Install-ActiveSetupStage.ps1 (Stages tool and registers HKLM Active Setup for multi-user OSD)
  • See sccm/README.md for the complete Task Sequence configuration guide, variable handling (_SMSTSLastActionSucceeded), and exit-code mapping.

Standardized Exit Codes (MDT/SCCM/Intune)

The script and module return deterministic exit codes to simplify enterprise orchestration:

  • 0: Success (System healthy or repaired successfully).
  • 1: Failure (Error during execution or verification failure).
  • 2: Dry-run mode completed successfully with simulated changes.
  • 3: Rollback completed successfully.

🛡️ Non-Destructive Architecture & Safety Standards

System utility execution demands strict isolation and deterministic boundaries. This engine operates under a non-destructive legal sandbox paradigm:

  • Transactional Backups: Prior to altering any registry keys under the user's environment block, the tool exports structured .reg files locally so changes can be reverted with a double-click.
  • Low-Level .NET Deletions: To bypass NTFS reparse point file locks where high-level cmdlets fail (Remove-Item), the script accesses the underlying file system primitives directly via [System.IO.File]::Delete().
  • Asymmetrical Elevation Protection: The script maps the actual interactive user token via explorer.exe process ownership rather than targeting the administrator profile's registry hive, preventing configuration bleed.
  • Deterministic Verification Framework: Zero guesswork. The remediation tree evaluates state changes post-fix and monitors thread stability using an explicit 3-second diagnostic execution timeout.

📖 Deep Dive & Technical Reference

If you are looking for the original technical deep dives, architectural breakdowns, historical edge cases, or deep platform context regarding this project:


🧪 Vetting Status

  • PSScriptAnalyzer Lint Compliance: 0 errors and 0 warnings on Repair-WingetAlias.ps1, checked on every pull request (lint.yml)
  • Integration Tests: the full E2E suite (tests/Run-Tests.ps1, Windows PowerShell 5.1 only) runs on every pull request (tests.yml) and must pass before a release is published (release.yml)

About

A diagnostic and remediation PowerShell tool to fix the Winget execution loop on Windows 11.

Topics

Resources

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages