diff --git a/scripts/Windows/Software/winget/Install.ps1 b/scripts/Windows/Software/winget/Install.ps1 index ced855b8f..109dd664e 100644 --- a/scripts/Windows/Software/winget/Install.ps1 +++ b/scripts/Windows/Software/winget/Install.ps1 @@ -2,38 +2,10 @@ . "$PSScriptRoot/../../Scripts/Context.ps1"; function Install-Winget { - param([Context] $context) - Write-Host "Installing winget"; - $namePattern = "*Desktop*Installer*"; - [System.Collections.Generic.List[string]] $packages = @(); - $versions = Get-AppxPackage -AllUsers "$namePattern"; - - if ($versions.Count -gt 0) { - if (-not $(Get-Command sqlite3)) { - $packages.Add("sqlite"); - } - - if ($packages.Count -gt 0) { - Write-Host "Installing prequisites for uninstalling winget"; - - foreach ($package in $packages) { - choco install -y "$package"; - } - } - - foreach ($version in $versions) { - sqlite3 ` - "$env:ProgramData\Microsoft\Windows\AppRepository\StateRepository-Machine.srd" ` - "UPDATE Package SET IsInbox = 0 WHERE PackageFullName = '$($version.PackageFullName)'"; - } - - Get-AppxPackage -AllUsers "$namePattern" | Remove-AppxPackage -AllUsers; - - Get-AppxProvisionedPackage -Online | ` - Where-Object { $_.DisplayName -like "$namePattern" } | ` - Remove-AppxProvisionedPackage -Online; - } - - choco install -y winget; + $downloadLink = "https://github.com/microsoft/winget-cli/releases/latest/download/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"; + $file = New-TemporaryFile; + $file = Rename-Item $file "$file.msixbundle"; + Invoke-WebRequest "$downloadLink" -OutFile "$file"; + Add-AppxPackage "$file"; + Remove-Item $file; } -