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?
Answers (4)
Top Answer
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.
Comments:
-
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. - ptireland 5 years ago
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
Comments:
-
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. - ptireland 5 years ago
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
======================================
http://www.74k.org/java-7-update-collection-query-for-pcs-not-on-the-current-version
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”