When upgrading an application one challenge can be that the previous version needs to be uninstalled before the new version is installed. Sometimes there could be more than one previous version that must be uninstalled during the upgrade. In this example we have the following requirements for the upgrade:
- If present Java 6.20 update 20 must be uninstalled before installing the new version.
- If present Java 6.20 update 21 must be uninstalled before installing the new version.
- If Java 6.20 update 21 is installed a reboot is required after the uninstallation.
As the example I posted before on how to use a task sequence to install applications with dependencies, a task sequence is the most efficient way to handle this. This assumes that the packages are created already in SCCM and bot install and uninstall programs exist.
- Create a custom task sequence
- Edit the task sequence and add “Install software” steps for all three applications, selecting the uninstall program for the Update 20 and Update 21 applications and the Install program for Update 22.
- On the Java 6 Update 20 step, select the options tab and add the following conditions:
1. An If statement, “None”
2. Select the If statement and add an “Installed Software” condition and browse and open the MSI file for Java 6 Update 20.
- Create a group called Java 6 Update 21, and repeat the condition steps above for that group aswell.
- In the Newly created group add a “Restart Computer” Task. Note! When adding a “restart task sequence step” the task sequence editor by default selects the option “The boot image assigned to this task sequence” this must be changed to “The currently installed default operating system” otherwise the task sequence will fail.
- The task sequence should now look like this and you are ready to advertise it and test it out.