$ver1 = "115.0.5790.99" $ver2 = "115.0.5790.171" Function verCompare($ver1, $ver2) { # returns whether ver1 is Less, Greater, or Equal to ver2 $ver1Array = $ver1.Split(".") $ver2Array = $ver2.Split(".") # Decide which array has the least amount of subversions and we'll only compare the least amount If ($ver1Array.count -ge $ver2Array.count) { $count = $ver1Array.count } Else { $count = $ver2Array.count } # Loop through each sub version and compare them. # Once I hit a Greater or Less than I change the count to break # Out of the for loop because there is no need to compare further For ($i = 0; $i -lt $count; $i++) { Switch ( $ver1Array[$i].CompareTo($ver2Array[$i]) ) { -1 { $compare = "$ver1 Less than $ver2"; $i = $count + 1 } 0 { $compare = "$ver1 Equal to $ver2" } 1 { $compare = "$ver1 Greater than $ver2"; $i = $count + 1 } } } return $compare } verCompare $ver1 $ver2