Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #111

Merged
merged 5 commits into from
Apr 30, 2024
Merged

Fixes #111

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions winget-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ function Install-Prerequisites {
Remove-Item -Path $VCLibsFile -Force
}

#Check available WinGet version, if fail set version to the latest version as of 2023-10-08
#Check available WinGet version, if fail set version to the latest version as of 2024-04-29
$WingetURL = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
try {
$WinGetAvailableVersion = ((Invoke-WebRequest $WingetURL -UseBasicParsing | ConvertFrom-Json)[0].tag_name).Replace("v", "")
}
catch {
$WinGetAvailableVersion = "1.6.2771"
$WinGetAvailableVersion = "1.7.11132"
}

#Get installed Winget version
Expand Down Expand Up @@ -410,9 +410,13 @@ function Uninstall-App ($AppID, $AppArgs) {

#Function to Add app to WAU white list
function Add-WAUWhiteList ($AppID) {
#Check if WAU default intall path exists
$WhiteList = "$WAUInstallLocation\included_apps.txt"
if (Test-Path $WhiteList) {
#Check if WAU default intall path is defined
if ($WAUInstallLocation) {
$WhiteList = "$WAUInstallLocation\included_apps.txt"
#Create included_apps.txt if it doesn't exist
if (!(Test-Path $WhiteList)) {
New-Item -ItemType File -Path $WhiteList -Force -ErrorAction SilentlyContinue
}
Write-ToLog "-> Add $AppID to WAU included_apps.txt"
#Add App to "included_apps.txt"
Add-Content -path $WhiteList -Value "`n$AppID" -Force
Expand Down