The easiest way to do this is just to use reports rather than queries. There are built-in reports that will tell you all the machines with a particular version of a particular product installed. Have a look at the reports in the "Software - Companies and Products" category, like "Computers with a specific product name and version".
If however you actually do need a query, if for instance, you need to create a collection of all of these that you can advertise a specific software package to, then the easiest way is to search for a particular file that will be common to all of these machines.
For example, if you know that the install packages used in your company always install Outlook as part of Office, you could use a query like this that looks for the Outlook EXE file, and checks its version.
For example by setting these criteria in a query:
Software Files.File Name is equal to "outlook.exe"
and
Software Files.File Version is greater than or equal to "11.0.8173.0"
Or this is the query language that the above translates into (this can be pasted into the Show Query Language box):
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_SoftwareFile on SMS_G_System_SoftwareFile.ResourceID = SMS_R_System.ResourceId
where SMS_G_System_SoftwareFile.FileName = "outlook.exe"
and SMS_G_System_SoftwareFile.FileVersion >= "11.0.8173.0"
For info, file versions for various Office versions and service packs can be found in these Technet pages:
For each product you wish to install you should check out its uninstall string here: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall. Not every product works with msiexec /x . Office 2010 and installshield applications are good examples.
For Installshield apps you will have to go through the painful process of creating an uninstall answer file by removing it manually first and then using that.
here is a good discussion on the problems for removing installshield applications.
Perhaps try uninstalling one application first via normal software distribution package and see if that works. Then you can start adding them to a task sequence. Bear in mind that a task sequence does not allow any user interaction.
Best Answer
Do the clients report the software version field as part of their hardware inventory? If not, this field will always be blank.
You can check this in your client settings. Edit the properties of the client settings that are deployed to your clients and go to:
Hardware inventory -> Hardware inventory classes -> Set classes button. Then search for "Installed Software" in the search field. If you expand the "Installed Software" node, you can enable the fields that the clients should report to ConfigMgr.
When you enable new fields here, you must wait until the clients run their next hardware inventory cycle, before the fields will be populated.