Scripting Question

SCCM query for two different versions of an installed application

11/10/2016 8114 views

Looking for how to write a WQL query that looks for either version A OR version B of an installed application. In my example below, I'm looking for the SAS Enterprise Guide executable, and I want to build a collection of computers that have either version 4.2 OR 4.3 installed.

I know I can write it like this:

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 = "SEGuide.exe" and SMS_G_System_SoftwareFile.FileVersion like "4.2%"

I can then make a second query, replacing "4.2" with "4.3", and then building a collection that includes both of those queries.

Just wondering if there's a way to include both versions into the same query.

Answer Summary:
0 Comments   [ + ] Show comments


Answer Chosen by the Author

Have you tried chopping off the .version so the wild card is earlier?

SMS_G_System_SoftwareFile.FileVersion like "4.2%"
SMS_G_System_SoftwareFile.FileVersion like "4.%"

Answered 11/13/2016 by: rileyz
Red Belt

  • Good thinking. That works--I was just curious if there was a way to incorporate unlike file versions (say, like version 7 or version 8, for example).
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ