wingetautoupdate/Winget-AutoUpdate/functions/Get-WinGetAvailableVersion.ps1

17 lines
491 B
PowerShell
Raw Normal View History

2023-10-08 09:37:27 +00:00
#Function to get the latest WinGet available version on Github
2023-10-09 22:03:10 +00:00
Function Get-WinGetAvailableVersion {
2023-10-08 09:37:27 +00:00
#Get latest WinGet info
$WinGeturl = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
try {
#Return latest version
return ((Invoke-WebRequest $WinGeturl -UseBasicParsing | ConvertFrom-Json)[0].tag_name).Replace("v", "")
}
catch {
2023-10-30 17:42:58 +00:00
#if fail set version to the latest version as of 2023-10-08
return "1.6.2771"
2023-10-08 09:37:27 +00:00
}
}