Hi,
You need quotes in your if statement. Replace
if ($CurrentVersion -le R18.2.51.0.0) {
With
if ($CurrentVersion -le 'R18.2.51.0.0') {
Also you are using the -le operator on a string object. I am on my iPad one, however I newer use anything else than -eq or -ne operators with strings. Looks like you will need to parse the string and create a custom object if you want to any do fancy operator action on current version. For instance: