06/19/2019 166 views
I need to push a software update to thousands of computers that have various previous versions but do not want it to install on systems that have never had the software installed.  I'm fairly sure I can do this with MSI codes, but I'm less than positive on how to accomplish it.  I know I can use the MSI codes to determine the existence of a particular version of the software.  I just don't know how to make sure it only deploys when it finds one of several MSI codes and not to install otherwise.
Answer Summary:
0 Comments   [ + ] Show comments


Answer Chosen by the Author


Easy. Create a query-based collection, where the query interrogates the product's ProductCode in HKLM\Software\Microsoft\Windows\CurrentVersion and set your deployment to target that collection.

Answered 06/20/2019 by: VBScab
Red Belt

  • I ended up using the MSI Product Codes (GUIDS) for old versions in the collection and the MSI code for the new version for the detection to see if the upgrade was already done. Then I did a requirement check for the executable file.

All Answers

You can use in a batch
if exist <insert file name here> <action>

Look for the existance of the exe and as action gosub to remove and install

to remove any version of a package you can use WMIC

As an example - this will remove all java - The %% acts like a wild card, you can use before and/or after the search wording also

wmic product where "name like 'Java%%'" call uninstall /nointeractive
wmic product where "name like 'Java%%' and not name like 'Java 8 Update 65%%'" call uninstall /nointeractive
wmic product where "name like 'Java%%' and not name like '%%Java 8%%'" call uninstall /nointeractive
Answered 06/19/2019 by: SMal.tmcc
Red Belt

  • I wanted to handle it with a script too, but my boss wants me to do it with the built-in SCCM logic for the application deployment. I had initially checked for the registry key and whether the file exists, but he said sometimes when you uninstall, the registry key remains, and MSI codes are more reliable.

You can do it multiple ways like

  1. The script testing for older versions
  2. A product like patchmypc what sends out updates via SCCM
  3. or just SCCM's query based collections.

Cheaper/cleaner version would be to make a query based collection and then target a deployment to it.

Say the older software is Java 7 then you can use something like below



Java 7 Collection Query

This query simply creates a collection of computers that have Java Version numbers lower than Java Version 7 Update 25.

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_ADD_REMOVE_PROGRAMS   on   SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId   where   SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName like “%Java 7 Update%”   and   SMS_G_System_ADD_REMOVE_PROGRAMS.Version < “7.0.250”

Answered 06/20/2019 by: nagendrasingh
Black Belt


You can use the query on bottom to make a collection based on a product code

Answered 06/23/2019 by: nagendrasingh
Black Belt