$SoftwareName = "FileZilla"
$ItemProperties = Get-ItemProperty "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" | Where Displayname -like "*$SoftwareName*"
[version]$Version='3.67.0'
#does item exist and less then version
if (($ItemProperties)-and ([version]$ItemProperties.DisplayVersion -lt $Version)
) {
Write-Host "Old Software Found Install"
Exit 1
} Else {
Write-Host "Software Not Found or Version Correct"
Exit 0
}
catch{
$errMsg = $_.exeption.essage
Write-Output $errMsg
}
#Install chocolatey if it doesn't exist
if (Get-Command -Name choco.exe -ErrorAction SilentlyContinue) {} else {
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
}
choco install filezilla
choco upgrade filezilla