From f361e92ac8ea8b7f19918bb71cc0af53e633be3c Mon Sep 17 00:00:00 2001 From: iRaven4522 Date: Sat, 6 Sep 2025 02:32:52 -0500 Subject: [PATCH] winget update --- Install-WinGet.ps1 | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/Install-WinGet.ps1 b/Install-WinGet.ps1 index 7b35936..755b528 100644 --- a/Install-WinGet.ps1 +++ b/Install-WinGet.ps1 @@ -24,6 +24,10 @@ Function Check-VCLibs { if ((Get-AppxPackage).Name -like "Microsoft.VCLibs.140.00.UWPDesktop" ) {return $true} else {return $false} } +Function Check-MSXaml { + if ((Get-AppxPackage).Name -like "Microsoft.UI.Xaml*" ) {return $true} else {return $false} +} + Function Install-VCLibs { if (Check-VCLibs) { Write-Output "VCLibs.UWPDesktop is already installed." @@ -38,6 +42,22 @@ Function Install-VCLibs { } } } + +Function Install-MSXaml { + if (Check-MSXaml) { + Write-Output "Microsoft.UI.Xaml is already installed." + } else { + cmd.exe /c "curl -L -o c:\irnh\msuixaml.zip https://www.nuget.org/api/v2/package/Microsoft.UI.Xaml" + try { + Expand-Archive c:\irnh\msuixaml.zip + Add-AppPackage .\msuixaml\tools\AppX\x64\Release\*.appx + Write-Output "Microsoft.UI.Xaml was installed." + } catch { + Write-Output "Microsoft.UI.Xaml could not be installed." + } + } +} + Function Install-WinGet { Write-Host "Checking latest version..." $WGLatestVer = (irm https://api.github.com/repos/microsoft/winget-cli/releases/latest).tag_name @@ -47,7 +67,7 @@ Function Install-WinGet { Write-Output "Domain Controllers has the latest version $WGDomainVer; using that." try { Add-AppxPackage -Path "\\technolog.net\SYSVOL\technolog.net\SoftwareDeploy\winget.msixbundle" - Add-AppxProvisionedPackage -Online -PackagePath "\\technolog.net\SYSVOL\technolog.net\SoftwareDeploy\winget.msixbundle" -LicensePath "\\technolog.net\SYSVOL\technolog.net\SoftwareDeploy\wingetlic.xml" + Add-AppxProvisionedPackage -Online -PackagePath "\\technolog.net\SYSVOL\technolog.net\SoftwareDeploy\winget.msixbundle" -LicensePath "\\technolog.net\SYSVOL\technolog.net\SoftwareDeploy\wingetlic.xml" -Verbose Write-Output "WinGet was successfully installed." } catch { Write-Output "WinGet could not be installed." @@ -56,17 +76,21 @@ Function Install-WinGet { else { # If the version we have on our domain controllers is NOT the latest, we have to get it online. Write-Host "Internet has the latest copy; downloading WinGet from Microsoft." - cmd.exe /c "curl -L -o c:\irnh\winget.msixbundle https://aka.ms/getwinget" # I hate IWR. lol - # download latest lic file + # download latest files foreach ($url in (irm https://api.github.com/repos/microsoft/winget-cli/releases/latest).assets.browser_download_url){ if ($url -like "*.xml") {cmd.exe /c "curl -L -o c:\irnh\wingetlic.xml $url"} # I hate IWR. lol + if ($url -like "*.msixbundle") + {cmd.exe /c "curl -L -o c:\irnh\winget.msixbundle $url"} # I hate IWR. lol } try { # Add-AppxPackage -Path "c:\irnh\winget.msixbundle" - Add-AppxPackage -Path "c:\irnh\winget.msixbundle" - Add-AppxProvisionedPackage -Online -PackagePath "c:\irnh\winget.msixbundle" -LicensePath "c:\irnh\wingetlic.xml" - Write-Output "WinGet was successfully installed." + Add-AppxPackage -Path "c:\irnh\winget.msixbundle" -Verbose + Add-AppxProvisionedPackage -Online -PackagePath "c:\irnh\winget.msixbundle" -LicensePath "c:\irnh\wingetlic.xml" -Verbose + $winget = winget -v + if ($winget) { + Write-Output "WinGet was successfully installed." + } } catch { Write-Output "WinGet could not be installed." } @@ -77,6 +101,7 @@ Function Install-WinGet { if (!(Check-WinGet-Install)) { Install-VCLibs + Install-MSXaml Install-WinGet } Stop-Transcript \ No newline at end of file