Citrix.Image.Uploader/VersionCheck.ps1


Function VersionCheck()
{
    $moduleName = 'Citrix.Image.Uploader'
    $moduleInfo = Get-InstalledModule $moduleName

    try
    {
        $response = Invoke-CCRestMethod -method 'Get' -serviceRoute "info/powershellModuleVersions"
        $latestVersion = $response.$moduleName
        Log "Latest version $latestVersion current version $($moduleInfo.Version)" $false
        if ($latestVersion -ne $moduleInfo.Version)
        {
            LogWarning "Update available: The latest version of $moduleName is $latestVersion and you have $($moduleInfo.Version). Please update to the latest and restart your shell."
        }
    }
    catch
    {
        Log "Failed to get latest version: $_" $false
    }
}