2024-11-24 20:14:10 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
function WingetInstall
|
|
|
|
{
|
2024-11-24 20:42:00 +00:00
|
|
|
$install = Read-Host "Install/Update WinGet now? [Y/n]"
|
2024-11-24 20:14:10 +00:00
|
|
|
if ($install.ToLower() -ne 'n')
|
2024-11-24 20:29:15 +00:00
|
|
|
{
|
|
|
|
# Start admin process, import this script, run 'InstallPackages' function
|
2024-11-24 20:35:50 +00:00
|
|
|
Start-Process powershell.exe -Verb RunAs -Wait `
|
2024-11-24 20:51:25 +00:00
|
|
|
-ArgumentList "-ExecutionPolicy", "Bypass", `
|
2024-11-24 21:39:20 +00:00
|
|
|
"-C", "cd $pwd; ipmo ./util/winget.psm1; InstallWinget"
|
2024-11-24 20:14:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
winget.exe install -s winget --accept-source-agreements (Get-Content ./util/winget.list)
|
|
|
|
}
|