I am trying to run the following batch script and it is not doing what I want it to. I want it to check to see if the version of a program exists in the registry and if it does, then uninstall it and install a later version but if it does not exists in the registry then just quit. The problem I am having is that it installs no matter if the version exists in the registry or not. I then want to creae a computer configuration start up script to push this out. Here is the code:
REG QUERY HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\FFD0D1F8C889BA64A87750A079B96B05\InstallProperties /v DisplayVersion | Find "DisplayVersion REG_SZ 7.5.087"
If ErrorLevel 0 goto Exists
If ErrorLevel 1 goto Not_Exists
msiexec.exe /m /x "\\myserver\old.msi" /qn
msiexec.exe /i "\\myserver\new.msi" /qn /norestart
Echo EC 7.5.087 Does Not Exists