diff --git a/Winget-AutoUpdate/winget-upgrade.ps1 b/Winget-AutoUpdate/winget-upgrade.ps1 index b4bb3bc..95ceb1c 100644 --- a/Winget-AutoUpdate/winget-upgrade.ps1 +++ b/Winget-AutoUpdate/winget-upgrade.ps1 @@ -233,6 +233,10 @@ function Start-WAUUpdateCheck{ [xml]$UpdateStatus = Get-Content "$WorkingDir\config\config.xml" -Encoding UTF8 -ErrorAction SilentlyContinue $AutoUpdateStatus = $UpdateStatus.app.WAUautoupdate + #Get current installed version + [xml]$About = Get-Content "$WorkingDir\config\about.xml" -Encoding UTF8 -ErrorAction SilentlyContinue + [version]$CurrentVersion = $About.app.version + #Check if AutoUpdate is enabled if ($AutoUpdateStatus -eq $false){ Write-Log "WAU Current version: $CurrentVersion. AutoUpdate is disabled." "Cyan" @@ -245,10 +249,6 @@ function Start-WAUUpdateCheck{ $LatestVersion = (Invoke-WebRequest $WAUurl | ConvertFrom-Json)[0].tag_name [version]$AvailableVersion = $LatestVersion.Replace("v","") - #Get current installed version - [xml]$About = Get-Content "$WorkingDir\config\about.xml" -Encoding UTF8 -ErrorAction SilentlyContinue - [version]$CurrentVersion = $About.app.version - #If newer version is avalable, return $True if ($AvailableVersion -gt $CurrentVersion){ Write-Log "WAU Current version: $CurrentVersion. Version $AvailableVersion is available." "Yellow"