I've written this code and does not have any error but the if part does not work another problem is that it does not consider the version number as a version so the is clause can cot work can someone guide me what the problem is
Windows client" | Select -first 1 )
$web.ParsedHtml.body.getElementsByClassName('vdi-links')[0].innerHTML -match "<LI>(\d{1,2}\.\d).*(https.*msi)"
$latestversion = Write-Host "$($Matches[1])".version
$FileName = write-host "Jabber $($Matches[1]).msi "
$downloadUrl= Write-Host "$($Matches[2])"
( $product= Get-WmiObject -Class Win32_Product | Where-Object name -Match 'Jabber' | Select-Object Name, Version )
$rootPath = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Cisco Jabber"
function download($thisLocalFile, $downloadurl){
Invoke-WebRequest -Uri "$downloadurl" -TimeoutSec 3 -OutFile "$thisLocalFile"
}
function createFolder($newFolder){
New-Item -Path $newFolder -ItemType "directory"
}
function checkParams(){
[version] $installedversion
[version] $latestversion
if( [version]$latestversion -lt [version]$installedversion){
download ($thisLocalFile,$downloadUrl)
createFolder ($newFolder)
$newFolder = $rootPath + "\" + $latestversion
$thisNewFile = $FileName
$thisLocalFile = $rootPath + "\" + $latestversion + "\" + $thisNewFile
$thisReturn = @($newFolder, $thisLocalFile, $sdownloadurl)
Return $thisReturn
Write-Host "1"
}
else
{
Write-Host "$latest version in already installed"
}
} ```