mirror of
https://github.com/Baipyrus/dotfiles.git
synced 2024-12-26 03:11:45 +00:00
replace builtin install method with web request to app installer
This commit is contained in:
parent
24b6d1f115
commit
4ce997d016
@ -1,12 +1,18 @@
|
||||
function InstallWinget
|
||||
{
|
||||
# Reference: https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget-on-windows-sandbox
|
||||
$progressPreference = 'silentlyContinue'
|
||||
Write-Host "Installing WinGet PowerShell module from PSGallery..."
|
||||
Install-PackageProvider -Name NuGet -Force | Out-Null
|
||||
Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null
|
||||
Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..."
|
||||
Repair-WinGetPackageManager
|
||||
$download = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
|
||||
$setup = "$env:TMP\winget_setup.msixbundle"
|
||||
|
||||
if (-not (Test-Path $setup))
|
||||
{
|
||||
$releases = Invoke-RestMethod $download
|
||||
$assets = $releases | Select-Object -ExpandProperty "assets"
|
||||
$installer = $assets | Where-Object "name" -Match "msixbundle"
|
||||
$url = $installer | Select-Object -ExpandProperty "browser_download_url"
|
||||
Invoke-RestMethod $url -OutFile $setup
|
||||
}
|
||||
|
||||
Add-AppxPackage -Path $setup
|
||||
}
|
||||
|
||||
function WingetInstall
|
||||
|
Loading…
Reference in New Issue
Block a user