From ffc5d6610d5a2fea1f865b34aaaca85c655873b1 Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Thu, 25 Apr 2024 05:19:18 +0200 Subject: [PATCH 1/7] Fix for [Bug]: -WAUWhitelist doesn't work if included_apps.txt does not already exist #605 --- Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 b/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 index e764292..f0278fa 100644 --- a/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 +++ b/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 @@ -258,6 +258,10 @@ function Uninstall-App ($AppID, $AppArgs) { function Add-WAUWhiteList ($AppID) { #Check if WAU default intall path exists $WhiteList = "$WAUInstallLocation\included_apps.txt" + #Create included_apps.txt if it doesn't exist + if ((Test-Path $WAUInstallLocation) -and !(Test-Path $WhiteList)) { + New-Item -ItemType File -Path $WhiteList -Force -ErrorAction SilentlyContinue + } if (Test-Path $WhiteList) { Write-ToLog "-> Add $AppID to WAU included_apps.txt" #Add App to "included_apps.txt" From c67eee36778a84f24a59982a51ebfdb46447326e Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Thu, 25 Apr 2024 17:34:34 +0200 Subject: [PATCH 2/7] Restart in hidden window --- Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 b/Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 index 879516f..d4958e5 100644 --- a/Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 +++ b/Sources/WAU/Winget-AutoUpdate/Winget-Upgrade.ps1 @@ -214,7 +214,7 @@ if (Test-Network) { #If _WAU-mods.ps1 has ExitCode 1 - Re-run WAU if ($ModsExitCode -eq 1) { Write-ToLog "Re-run WAU" - Start-Process powershell -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command `"$WorkingDir\winget-upgrade.ps1`"" + Start-Process powershell -ArgumentList "-NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -Command `"$WorkingDir\winget-upgrade.ps1`"" Exit } } From 4563b7b5f605666e09b7e2ab6e7656ee3003642e Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Fri, 26 Apr 2024 03:56:21 +0200 Subject: [PATCH 3/7] Better fix --- Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 b/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 index f0278fa..73f4395 100644 --- a/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 +++ b/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 @@ -256,13 +256,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" - #Create included_apps.txt if it doesn't exist - if ((Test-Path $WAUInstallLocation) -and !(Test-Path $WhiteList)) { - New-Item -ItemType File -Path $WhiteList -Force -ErrorAction SilentlyContinue - } - 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 From 41063c46cf2f78c3bc5969b3282394de0d62bab6 Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Mon, 29 Apr 2024 15:00:06 +0200 Subject: [PATCH 4/7] Req for WSB! --- .../functions/Install-Prerequisites.ps1 | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Install-Prerequisites.ps1 b/Sources/WAU/Winget-AutoUpdate/functions/Install-Prerequisites.ps1 index 75a689f..98195d9 100644 --- a/Sources/WAU/Winget-AutoUpdate/functions/Install-Prerequisites.ps1 +++ b/Sources/WAU/Winget-AutoUpdate/functions/Install-Prerequisites.ps1 @@ -64,6 +64,28 @@ function Install-Prerequisites { } } + #Check if Microsoft.UI.Xaml.2.8 is installed (Req for WSB: https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget-on-windows-sandbox) + if (!(Get-AppxPackage -Name 'Microsoft.UI.Xaml.2.8' -AllUsers)) { + try { + Write-ToLog "Microsoft.UI.Xaml.2.8 is not installed" "Red" + #Download + $UIXamlUrl = "https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx" + $UIXamlFile = "$env:TEMP\Microsoft.UI.Xaml.2.8.x64.appx" + Write-ToLog "-> Downloading Microsoft.UI.Xaml.2.8..." + Invoke-RestMethod -Uri $UIXamlUrl -OutFile $UIXamlFile + #Install + Write-ToLog "-> Installing Microsoft.UI.Xaml.2.8..." + Add-AppxProvisionedPackage -Online -PackagePath $UIXamlFile -SkipLicense | Out-Null + Write-ToLog "-> Microsoft.UI.Xaml.2.8 installed successfully." "Green" + } + catch { + Write-ToLog "-> Failed to intall Microsoft.UI.Xaml.2.8..." "Red" + } + finally { + Remove-Item -Path $UIXamlFile -Force + } + } + Write-ToLog "Prerequisites checked. OK`n" "Green" } From 4fa99f33149c3aba14eddf8831e92b99aee07f66 Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Mon, 29 Apr 2024 15:43:25 +0200 Subject: [PATCH 5/7] Reversing WSB Fix --- .../functions/Install-Prerequisites.ps1 | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Install-Prerequisites.ps1 b/Sources/WAU/Winget-AutoUpdate/functions/Install-Prerequisites.ps1 index 98195d9..75a689f 100644 --- a/Sources/WAU/Winget-AutoUpdate/functions/Install-Prerequisites.ps1 +++ b/Sources/WAU/Winget-AutoUpdate/functions/Install-Prerequisites.ps1 @@ -64,28 +64,6 @@ function Install-Prerequisites { } } - #Check if Microsoft.UI.Xaml.2.8 is installed (Req for WSB: https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget-on-windows-sandbox) - if (!(Get-AppxPackage -Name 'Microsoft.UI.Xaml.2.8' -AllUsers)) { - try { - Write-ToLog "Microsoft.UI.Xaml.2.8 is not installed" "Red" - #Download - $UIXamlUrl = "https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx" - $UIXamlFile = "$env:TEMP\Microsoft.UI.Xaml.2.8.x64.appx" - Write-ToLog "-> Downloading Microsoft.UI.Xaml.2.8..." - Invoke-RestMethod -Uri $UIXamlUrl -OutFile $UIXamlFile - #Install - Write-ToLog "-> Installing Microsoft.UI.Xaml.2.8..." - Add-AppxProvisionedPackage -Online -PackagePath $UIXamlFile -SkipLicense | Out-Null - Write-ToLog "-> Microsoft.UI.Xaml.2.8 installed successfully." "Green" - } - catch { - Write-ToLog "-> Failed to intall Microsoft.UI.Xaml.2.8..." "Red" - } - finally { - Remove-Item -Path $UIXamlFile -Force - } - } - Write-ToLog "Prerequisites checked. OK`n" "Green" } From 9a493e4116fc4cf6d8f94071b0bba0cec0bc3503 Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Mon, 29 Apr 2024 19:49:34 +0200 Subject: [PATCH 6/7] WSB Fix back --- .../functions/Install-Prerequisites.ps1 | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Install-Prerequisites.ps1 b/Sources/WAU/Winget-AutoUpdate/functions/Install-Prerequisites.ps1 index 75a689f..e415828 100644 --- a/Sources/WAU/Winget-AutoUpdate/functions/Install-Prerequisites.ps1 +++ b/Sources/WAU/Winget-AutoUpdate/functions/Install-Prerequisites.ps1 @@ -64,6 +64,28 @@ function Install-Prerequisites { } } + #Check if Microsoft.UI.Xaml.2.8 is installed + if (!(Get-AppxPackage -Name 'Microsoft.UI.Xaml.2.8' -AllUsers)) { + try { + Write-ToLog "Microsoft.UI.Xaml.2.8 is not installed" "Red" + #Download + $UIXamlUrl = "https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx" + $UIXamlFile = "$env:TEMP\Microsoft.UI.Xaml.2.8.x64.appx" + Write-ToLog "-> Downloading Microsoft.UI.Xaml.2.8..." + Invoke-RestMethod -Uri $UIXamlUrl -OutFile $UIXamlFile + #Install + Write-ToLog "-> Installing Microsoft.UI.Xaml.2.8..." + Add-AppxProvisionedPackage -Online -PackagePath $UIXamlFile -SkipLicense | Out-Null + Write-ToLog "-> Microsoft.UI.Xaml.2.8 installed successfully." "Green" + } + catch { + Write-ToLog "-> Failed to intall Microsoft.UI.Xaml.2.8..." "Red" + } + finally { + Remove-Item -Path $UIXamlFile -Force + } + } + Write-ToLog "Prerequisites checked. OK`n" "Green" } From 08038982efb464ad836a88e78130bd9e990aa247 Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Mon, 29 Apr 2024 19:51:21 +0200 Subject: [PATCH 7/7] Winget 1.7.11132 --- Sources/WAU/Winget-AutoUpdate/functions/Update-WinGet.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/WAU/Winget-AutoUpdate/functions/Update-WinGet.ps1 b/Sources/WAU/Winget-AutoUpdate/functions/Update-WinGet.ps1 index 73b2bfb..88bf74a 100644 --- a/Sources/WAU/Winget-AutoUpdate/functions/Update-WinGet.ps1 +++ b/Sources/WAU/Winget-AutoUpdate/functions/Update-WinGet.ps1 @@ -12,8 +12,8 @@ Function Update-WinGet { $WinGetAvailableVersion = ((Invoke-WebRequest $WinGeturl -UseBasicParsing | ConvertFrom-Json)[0].tag_name).Replace("v", "") } catch { - #if fail set version to the latest version as of 2023-10-08 - $WinGetAvailableVersion = "1.6.2771" + #if fail set version to the latest version as of 2024-04-29 + $WinGetAvailableVersion = "1.7.11132" } try {