Detection methods allow the administrator to check software installs to ensure that the application is not already installed. It can also prevent an install of an application if it conflicts with another application that is already installed.
Usually in our batch file we put the query method to detect the new version or the old version. Here in the App Model we have Detection Method which we can use while creating the package in App-model.
I want to install Microsoft .Net 4.5 on my machine and it should upgrade if the machine is having any old version of .Net
- In General tab of the Deployment Type Page Select Script Installer.
Note: For Files like .exe,.vbs,.cmd we have to choose Script Installer.
- In Program Page browse the file with the switches.
- In Detection Page Click on Add Clause Button on the right side of the Panel.
- For detecting the new version of the application, here we can choose Registry in Setting Type.
- Expand the Registry and choose the Microsoft .Net 4.5 Product Code and Click on OK.
- Select the Data Type as String and click OK
- Set the below User Experience field and click OK.
- This way we can detect the new version of the application. It will skip to run the package if it is already present in the machine otherwise it will upgrade over the older one.
We have another two methods for detecting the installed application.
- The first method is file system. This method detects whether a file or folder is present on the system. If the file system object is not present, the application is marked as not installed.
- You can use the “Browse” button to find the file on your computer. This will pull in all relevant information, such as the file version or modified date.
- One important thing to watch is the “This file or folder is associated with a 32-bit application on 64-bit systems” check box. By default, if you are on a 64-bit system, SCCM will only verify against “C:\Program Files” or “C:\Windows\system32” for files or folders and not “Program Files (x86)” or “SysWOW64”. If the application installs to “C:\ProgramFiles (x86)” or puts something in “C:\Windows\SysWOW64” and you queue off of that file, SCCM will not find it. When the user attempts to run the application, it will install again, possibly corrupting it or making it unusable.
- This method is automatically filled in when using an MSI install type. This method detects whether the MSI product code exists on the system. This method should only be used when dealing with an MSI. If you do not use the MSI install type, you can use the “Browse” button and find the MSI installer to automatically pull the product code.
- For products that update, but keep the same product code, you can use the “This MSI product code must exist on the target system and the following condition must be met to indicate the presence of this application” options to specify the version of the MSI.