Skip to content

Commit

Permalink
Update CheckNCPAVersion.ps1
Browse files Browse the repository at this point in the history
- Update logic
- Update format to match other plugin styles
  • Loading branch information
sawft99 authored May 28, 2024
1 parent f8ccea7 commit 98ef440
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions CheckNCPAVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#Forces TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

#Find latest version from Github
$LatestVersion = ((Invoke-WebRequest $NCPAVersionURL.Uri -UseBasicParsing).Content).TrimEnd('')
$CurrentVersion = $NCPAExe.VersionInfo.ProductVersion

Expand All @@ -13,15 +15,15 @@ $CurrentVersion = $NCPAExe.VersionInfo.ProductVersion
if (!(Test-Path $NCPAExe)) {
Write-Output 'CRITICAL: NCPA not found'
$LASTEXITCODE = 2
}

if ($CurrentVersion -eq $LatestVersion) {
} elseif ($CurrentVersion -eq $LatestVersion) {
Write-Output 'OK: NCPA is up to date'
Write-Output "Current verison is $CurrentVersion and the latest version is $LatestVersion"
Write-Output "Latest Version: $LatestVersion"
Write-Output "Current Verison: $CurrentVersion"
$LASTEXITCODE = 0
} elseif ($CurrentVersion -ne $LatestVersion) {
Write-Output 'WARNING: NCPAis out of date'
Write-Output "Current verison is $CurrentVersion and the latest version is $LatestVersion"
Write-Output 'WARNING: NCPA is out of date'
Write-Output "Latest Version: $LatestVersion"
Write-Output "Current Verison: $CurrentVersion"
$LASTEXITCODE = 1
} else {
Write-Output 'UNKNOWN: Unknown issue'
Expand Down

0 comments on commit 98ef440

Please sign in to comment.