Endpoint Insights

Subselect WQL to Find PCs That Don’t Have x86 or x64 Versions of Software

Topics: Endpoint Insights

In my blog post series about how queries are processed, I showed you yesterday how to create a subselect WQL query to find all PCs without Microsoft Project 2010 installed. As promised at the end of that post, I will show you how to query for either x86 or x64 versions of a software title.

If you would like to read more about how queries are processed, here is a link to the first post in this 6-part series.
Subselect WQL Query to Find PCs That Do Not Have Either x86 or x64 Versions of Software Installed
Again, I will use Microsoft Project 2010 for my example. The key element to this query is knowing that x86 and x64 software titles are found in different WQL views.
These views are:

X86

SMS_G_System_ADD_REMOVE_PROGRAMS

 

X64 
SMS_G_System_ADD_REMOVE_PROGRAMS_64 

The positive query should look similar to this example:

Select distinct

  SMS_R_System.ResourceId

From 

  SMS_R_System

Where

  SMS_R_System.ResourceId in

     (

        Select

          SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID

        From

          SMS_G_System_ADD_REMOVE_PROGRAMS

        Where

          SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName = “Microsoft Project 2010”

      )

  or SMS_R_System.ResourceId in

     ( 

        Select

            SMS_G_System_ADD_REMOVE_PROGRAMS_64.ResourceID

          From

            SMS_G_System_ADD_REMOVE_PROGRAMS_64

          Where

            SMS_G_System_ADD_REMOVE_PROGRAMS_64.DisplayName = “Microsoft Project 2010”

      )

 

The subselect query combines the above positive query with a negative query:

Select distinct

                SMS_R_System.Name

From 

                SMS_R_System 

Where

                SMS_R_System.ResourceId not in

                (

                                Select

                                                SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID

                                From

                                                SMS_G_System_ADD_REMOVE_PROGRAMS

                                Where

                                                SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName = “Microsoft Project 2010”

                )

                And SMS_R_System.ResourceId not in

                ( 

                                Select

                                                SMS_G_System_ADD_REMOVE_PROGRAMS_64.ResourceID

                                From

                                                SMS_G_System_ADD_REMOVE_PROGRAMS_64

                                Where

                                                SMS_G_System_ADD_REMOVE_PROGRAMS_64.DisplayName = “Microsoft Project 2010”

                )

Having one query to find either x86 or x64 software titles is useful when creating a collection of all PCs that do not have a specific software title installed. This collection can be used to install software without having to worry if the PC is x86 or x64. This query can also be helpful when the software display name changes between x86 and x64.
This is my last blog post in this series. I welcome your comments, so send them to my Twitter handle @GarthMJ.

Back to Top