cancel
Showing results for 
Search instead for 
Did you mean: 

Script to find an application version less than the current version

urvashi
Community Manager Community Manager
Community Manager

Hello all, reposting a question and the script from a conversation in our JumpCloud Slack Lounge

Question from @namlam: "Hello All, do you know a powershell command that can find an application version less than the current version. For example, how to find out any system that has Chrome version below 140.00"

Response from Josh C.: "Quick and dirty, writes to output any windows device with chrome version below 117.0.5938.150. Update the Target Version variable on line 8 for the version you want to be your cutoff.
It's not fast, but it works. This is run from your machine in powershell btw, it will prompt you for your api key and org ID and then run against your org's Database."

 

 

$allSystems = Get-JcSdkSystem
foreach ($system in $allSystems)
{
    # Check if Windows machine
    if ($system.OS -eq 'Windows')
    {
        #Set Target Version
        $TargetVersion= [System.Version]"117.0.5938.150"

        #Get list of all installed programs 
        $programs = Get-JCSystemInsights -Table Program -SystemId $system.Id
        if ($programs.name -contains "Google Chrome")
        {
            ForEach ($program in $Programs)
            {
                if(($Program.name -like "Google Chrome" ) -and $Program.Version -lt $TargetVersion)
                {
                     Write-Host $system.DisplayName
                }
            }
        }
    }
}

 

Thank you Nam and Josh for your contributions to the JumpCloud Community 🙂

 

0 REPLIES 0