Hi together,
I’ve recently encountered a Powershell problem and don’t quite know what’s causing it yet. Below you can see a section from my PSADT.
$DoesRegKeyExists = Get-ItemProperty -Path $var_keys -ErrorAction 'SilentlyContinue' | ? { ($_.DisplayName -like "*$var_name*") -or ($_.PsChildName -like "*$var_name*") } | Select-Object Publisher,DisplayVersion,DisplayName,UninstallString,QuietUninstallString If ([Version]$appVersion -gt [Version]$DoesRegKeyExists.DisplayVersion)
The section looks for the software on the PC and compares the version of it with the version defined in the package. If the package version is greater, the software is uninstalled and then the new one is installed. But I had problems that sometimes it could not compare the versions correctly (e.g. 10.10.10.1 vs. 8.10.10.3) It thought that the second version is bigger. So I put [version] in front of it and it worked again. The packages also run cleanly in my test environment in Intune. But productively it came to this error message… And this message I do not quite understand. My guess is that the software is already installed and somehow in the system context or something. Do you know what I mean?
Does anyone know what the problem is and how to solve it?
Thanks a lot!