winget update
This commit is contained in:
@@ -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"
|
||||
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
|
Reference in New Issue
Block a user