I want to compare create a function that compare/verifies that a version number is smaller than the another one. The numbers are :
$version1 = 23.0.46.0
$version2 = 24.1.154.0
When I use a simple if condition like below, it does not work because it gives me False
IF(23.0.46.0 -lt 24.1.154.0){
Write-Host "True"
}
Else
{
Write-Host "False"
}
I have the idea to split the version number by the points into an array. Then do a loop to compare the parts of each versions until that one is smaller than the another one. In this case it would be directly in the first iteration because 23<24. However I am newly in Powersehll
Thank you for your help