Hi Everyone,

Yesterday one of my colleague asked me to create a task sequence which first checks if a specific version of a program installed on the client machine and if it is installed, it will first uninstalls it and then it will install the latest version of the program. Let's see how I did it. 

 

First I need to create an uninstall package and the command I need to use something like this.

msiexec.exe /x {your-product-code-guid} 

 

To obtain the product code GUID, you can run this command and on a client machine on which that specific version of the program installed.

get-wmiobject Win32_Product | Format-Table IdentifyingNumber, Name, LocalPackage -AutoSize

 

 

 

This the GUID I will use

{BBAA7ABC-1B9F-410C-BB9E-D55285AAB9F0}  

 

Create a batch file and add the below uninstall command in it. 

msiexec /x {BBAA7ABC-1B9F-410C-BB9E-D55285AAB9F0} /qn /norestart 

 

 

 

Create the Uninstall Package:

We can now create the uninstall package, browse the folder path in which your batch file resides

 

 

 

 

Choose Standard program 

 

 

Make sure you enter the name of the batch file in command line box and complete the rest of the wizard. Distribute this package to DPs.

 

 

 

 

Create the Application:

 Let's create the application we will install at the final step of our task sequence. 

 

 

 

complete the wizard and distribute the Application to DPs.

 

 

 

Create the Task Sequnce:

Now lets create a Custom Task Sequence. Right click and Edit the TS.

Add>Software>Install Package

This task step (Uninstalling) will be executed if the specified software is installed, if not the step will be skipped.

Name this step as Uninstalling X Program, click on Options Tab

Add Condition> If Statement > All Conditions

Add Condition>  Query WMI > WMI Namespace root\cimv2

 WQL Query: select * from win32_product where name like "%displaylink%" and version = "8.3.2010.0"

 

 

It is important that you select the correct namespace and class when you are generating your WQL Query. You can use WMI Explorer Tool to test your WQL queries. On a client computer, run WMI Explorer Tool> select namespace and class and type in the query you wanna test and hit execute. If namespace and class and the query you run is valid, you will see its result like the picture below.Otherwise it will give error message stating "invalid class". 

 

 

 

 

Now add a step to install the application

 Add>Software>Install > Hit the Star Icon and add the application you want to install

 

 

In Conclusion, task sequence will check if the specifed software is installed or not. If it is not installled it will continue to second step and install the application. If software is found, it will first uninstall it, and the install the application.

 

 

 

 

 

 

Hylafax Installation on Debian

Easy to start HylaFAX is a free linux-based fax server. It is used by many companies worldwide. In this article, we are going to install and configure HylaFAX.

More...

Creating Multiple Users on Active Directory

Docs / SupportIf you are working in an organization which receives a lot new users on several periods of the year, then you should handle creation of domain users  with the help of Powershell. 

More...

How To Change Default Computer OU

Native RTL SupportWhen you join a computer to the domain, Computer Object is created and placed in Default Computer Container which is not an organizational unit and we all know that, GPOs can be only applied to Organizational Units. 

More...

JSN Epic template designed by JoomlaShine.com