WinGet Reinstall
functions/public/Invoke-WPFFixesWinget.ps1
1function Invoke-WPFFixesWinget {
2
3 <#
4
5 .SYNOPSIS
6 Fixes Winget by running choco install winget
7 .DESCRIPTION
8 BravoNorris for the fantastic idea of a button to reinstall winget
9 #>
10 # Install Choco if not already present
11 try {
12 Set-WinUtilTaskbaritem -state "Indeterminate" -overlay "logo"
13 Write-Host "==> Starting Winget Repair"
14 Install-WinUtilWinget
15 } catch {
16 Write-Error "Failed to install winget: $_"
17 Set-WinUtilTaskbaritem -state "Error" -overlay "warning"
18 } finally {
19 Write-Host "==> Finished Winget Repair"
20 Set-WinUtilTaskbaritem -state "None" -overlay "checkmark"
21 }
22
23}