Can I use MSI codes to push an application upgrade in SCCM only to systems that have previous versions of it and not to systems that do not have the application?
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
You can do it multiple ways like
- The script testing for older versions
- A product like patchmypc what sends out updates via SCCM
- 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”