VersionCheck.ps1


Function VersionCheck([string]$Deployment, [string]$CustomerId)
{
    $moduleName = 'Citrix.Workloads.Portability'
    $moduleInfo = Get-InstalledModule $moduleName

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