Winget Repair Script - Location? #3875
-
I'm working on some winget tooling on my own, and found that my scripts don't run during Windows install, but after I install UniGetUI, it immediately prompts to repair Winget, and afterwards my scripts run without issue. Where is this piece of Powershell code? I can't find it in the source files or in the installation directory. Or is there a way to trigger UniGetUI's repair script from command line? |
Beta Was this translation helpful? Give feedback.
Answered by
marticliment
Jul 18, 2025
Replies: 1 comment
-
The WinGet repair script is hardcoded into UniGetUI. this is the code that spawns the script: using Process p = new Process
{
StartInfo = new()
{
FileName = CoreData.PowerShell5,
Arguments =
"-ExecutionPolicy Bypass -NoLogo -NoProfile -Command \"& {" +
"cmd.exe /C \"rmdir /Q /S `\"%temp%\\WinGet`\"\"; " +
"cmd.exe /C \"`\"%localappdata%\\Microsoft\\WindowsApps\\winget.exe`\" source reset --force\"; " +
"taskkill /im winget.exe /f; " +
"taskkill /im WindowsPackageManagerServer.exe /f; " +
"Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force; " +
"Install-Module Microsoft.WinGet.Client -Force -AllowClobber; " +
"Import-Module Microsoft.WinGet.Client; " +
"Repair-WinGetPackageManager -Force -Latest; " +
"Get-AppxPackage -Name 'Microsoft.DesktopAppInstaller' | Reset-AppxPackage; " +
"}\"",
UseShellExecute = true,
Verb = "runas"
}
};
p.Start();
await p.WaitForExitAsync(); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Harshmage
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The WinGet repair script is hardcoded into UniGetUI. this is the code that spawns the script: