23 lines
1.1 KiB
PowerShell
23 lines
1.1 KiB
PowerShell
# Script to update the winget installer (msixbundle) on a server that hosts it.
|
|
# Technolog Networks, 2024-07-26
|
|
# iRaven
|
|
|
|
Start-Transcript -Path "Update-WinGet-Installer.log" -Append
|
|
|
|
Write-Host "Checking latest version..."
|
|
$WGLatestVer = (irm https://api.github.com/repos/microsoft/winget-cli/releases/latest).tag_name
|
|
$WGDomainVer = type "\\technolog.net\SYSVOL\technolog.net\SoftwareDeploy\wingetlatestver.txt"
|
|
if ($WGDomainVer -eq $WGLatestVer) {
|
|
# If the version we have on our domain controllers is the latest, don't do anything.
|
|
Write-Host "Version is up to date. No changes were made"
|
|
Stop-Transcript
|
|
}
|
|
else {
|
|
# If the version we have on our domain controllers is NOT the latest, we have to get it online.
|
|
cmd.exe /c "curl -L -o winget.msixbundle https://aka.ms/getwinget" # I hate IWR. lol
|
|
cmd.exe /c "curl -L -o vclibs.14.00.Desktop.appx https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx"
|
|
Copy-Item -Path "winget.msixbundle" "\\technolog.net\SYSVOL\technolog.net\SoftwareDeploy\winget.msixbundle"
|
|
$WGLatestVer > "\\technolog.net\SYSVOL\technolog.net\SoftwareDeploy\wingetlatestver.txt"
|
|
}
|
|
|
|
Stop-Transcript |