From 37137178900b9b88fb23e054817b6b6ee87b3cff Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Sun, 10 Sep 2023 00:35:25 +0200 Subject: [PATCH] Better info --- Winget-AutoUpdate-Install.ps1 | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Winget-AutoUpdate-Install.ps1 b/Winget-AutoUpdate-Install.ps1 index ebf2c88..b4ad390 100644 --- a/Winget-AutoUpdate-Install.ps1 +++ b/Winget-AutoUpdate-Install.ps1 @@ -163,10 +163,10 @@ function Install-Prerequisites { Write-host "-> Installing VC_redist.$OSArch.exe..." Start-Process -FilePath $Installer -Args "/quiet /norestart" -Wait Remove-Item $Installer -ErrorAction Ignore - Write-host "-> MS Visual C++ 2015-2022 installed successfully" -ForegroundColor Green + Write-host "MS Visual C++ 2015-2022 installed successfully" -ForegroundColor Green } catch { - Write-host "-> MS Visual C++ 2015-2022 installation failed." -ForegroundColor Red + Write-host "MS Visual C++ 2015-2022 installation failed." -ForegroundColor Red Start-Sleep 3 } } @@ -189,15 +189,16 @@ function Install-WinGet { #Current: v1.5.1881 = 1.20.1881.0 = 2023.707.2257.0 If ([Version]$TestWinGet.Version -ge "2023.707.2257.0") { - Write-Host "WinGet is Installed" -ForegroundColor Green + Write-Host "Winget is Installed" -ForegroundColor Green } Else { - #Installing Dependencies in SYSTEM context - #Download Microsoft.UI.Xaml.2.7 + Write-Host "-> Winget is not installed:" + + #Downloading and Installing Dependencies in SYSTEM context if (!(Get-AppxPackage -Name 'Microsoft.UI.Xaml.2.7')) { - #Install + Write-Host "-> Downloading Microsoft.UI.Xaml.2.7..." $UiXamlUrl = "https://www.nuget.org/api/v2/package/Microsoft.UI.Xaml/2.7.0" $UiXamlZip = "$WingetUpdatePath\Microsoft.UI.XAML.2.7.zip" Invoke-RestMethod -Uri $UiXamlUrl -OutFile $UiXamlZip @@ -205,6 +206,7 @@ function Install-WinGet { try { Write-Host "-> Installing Microsoft.UI.Xaml.2.7..." Add-AppxProvisionedPackage -Online -PackagePath "$WingetUpdatePath\extracted\tools\AppX\x64\Release\Microsoft.UI.Xaml.2.7.appx" -SkipLicense | Out-Null + Write-host "Microsoft.UI.Xaml.2.7 installed successfully" -ForegroundColor Green } catch { Write-Host "Failed to intall Wicrosoft.UI.Xaml.2.7..." -ForegroundColor Red @@ -213,14 +215,15 @@ function Install-WinGet { Remove-Item -Path "$WingetUpdatePath\extracted" -Force -Recurse } - #Download Microsoft.VCLibs.140.00.UWPDesktop if (!(Get-AppxPackage -Name 'Microsoft.VCLibs.140.00.UWPDesktop')) { + Write-Host "-> Downloading Microsoft.VCLibs.140.00.UWPDesktop..." $VCLibsUrl = "https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx" $VCLibsFile = "$WingetUpdatePath\Microsoft.VCLibs.x64.14.00.Desktop.appx" Invoke-RestMethod -Uri $VCLibsUrl -OutFile $VCLibsFile try { Write-Host "-> Installing Microsoft.VCLibs.140.00.UWPDesktop..." Add-AppxProvisionedPackage -Online -PackagePath $VCLibsFile -SkipLicense | Out-Null + Write-host "Microsoft.VCLibs.140.00.UWPDesktop installed successfully" -ForegroundColor Green } catch { Write-Host "Failed to intall Microsoft.VCLibs.140.00.UWPDesktop..." -ForegroundColor Red @@ -229,7 +232,7 @@ function Install-WinGet { } #Download WinGet MSIXBundle - Write-Host "-> Not installed. Downloading WinGet..." + Write-Host "-> Downloading Winget MSIXBundle for App Installer..." $WinGetURL = "https://github.com/microsoft/winget-cli/releases/download/v1.5.1881/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" $WebClient = New-Object System.Net.WebClient $WebClient.DownloadFile($WinGetURL, "$WingetUpdatePath\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle") @@ -238,7 +241,7 @@ function Install-WinGet { try { Write-Host "-> Installing Winget MSIXBundle for App Installer..." Add-AppxProvisionedPackage -Online -PackagePath "$WingetUpdatePath\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" -SkipLicense | Out-Null - Write-Host "Installed Winget MSIXBundle for App Installer" -ForegroundColor Green + Write-host "Winget MSIXBundle for App Installer installed successfully" -ForegroundColor Green } catch { Write-Host "Failed to intall Winget MSIXBundle for App Installer..." -ForegroundColor Red