mirror of
https://github.com/Baipyrus/dotfiles.git
synced 2024-12-26 11:21:46 +00:00
30 lines
1.1 KiB
PowerShell
30 lines
1.1 KiB
PowerShell
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
|
|
{
|
|
$update = Read-Host "Install/Update WinGet now? [Y/n]"
|
|
if ($update.ToLower() -ne 'n')
|
|
{
|
|
# Start admin process, import this script, run 'InstallPackages' function
|
|
Start-Process powershell.exe -Verb RunAs -Wait `
|
|
-ArgumentList "-ExecutionPolicy", "Bypass", `
|
|
"-C", "cd $pwd; ipmo ./util/winget.psm1; InstallWinget"
|
|
}
|
|
|
|
$install = Read-Host "Install WinGet Packages now? [Y/n]"
|
|
if ($install.ToLower() -eq 'n')
|
|
{ return
|
|
}
|
|
|
|
winget.exe install -s winget --accept-source-agreements (Get-Content ./util/winget.list)
|
|
}
|