Combining multiple queries in one collection – SCCM

I was hired for one secondment, and I moved to  much bigger  environment. And one of task was to deploy Office 2016. Ill write another post of deploying Office 2016 with scripts to uninstall previous version of Office.

After some digging, I figured that environment has mixed versions of Office in place.  After creating initial Collections for Office 2010 and 2013, also I created the 32bit versions of collection.
Below you can find examples for query of Office 2016

The best way to detect applications is to use GUID of programs you wish to detect.

Also you can use this information  using powershell command to get some third party application GUID and implement detection method.

The command is:

wmic product where "Name like '%Office%'" get name,version,identifyingnumber


This is GUID for Office versions.

Office 2013 (32-bit) 

Display Name                                  Product ID
------------                                  ----------
Microsoft Office Professional Plus 2013       {90150000-0011-0000-0000-0000000FF1CE}
Microsoft Visio Professional 2013             {90150000-0051-0000-0000-0000000FF1CE}
Microsoft Project Professional 2013           {90150000-003B-0000-0000-0000000FF1CE}

Office 2013 (64-bit) 

Display Name                                  Product ID
------------                                  ----------
Microsoft Office Professional Plus 2013       {90150000-0011-0000-1000-0000000FF1CE}
Microsoft Visio Professional 2013             {90150000-0051-0000-1000-0000000FF1CE}
Microsoft Project Professional 2013           {90150000-003B-0000-1000-0000000FF1CE}

Office 2016 (64-bit) 

Display Name                                  Product ID
------------                                  ----------
Microsoft Office Professional Plus 2016       {90160000-0011-0000-1000-0000000FF1CE}
Microsoft Visio Professional 2016             {90160000-0051-0000-1000-0000000FF1CE}
Microsoft Project Professional 2016           {90160000-003B-0000-1000-0000000FF1CE}


This is example of collection query based on version of Office installed. Its pretty self explanatory.


Office 2013 – 32 bit Detection rule
office 2016
Office 2016 – 64 bit Detection  rule









But I wanted to check if there is computers that have Office 2010 and 2016, installed, or any other combination.

So, the way to accomplish this is to create two query in query rule.
I presume that you are able to create SCCM collection and to create rule for that collection, so that part is not covered in this blog.

We will use example of querying computers that have Office 2013 and Office 2016 installed. Sometimes you cant accomplish Query using only SCCM console GUI, and you need to write your on query.

If using GUI you will create query for example Office 2010 and Office 2016. Its important when you create second query inside this Criteria, to use logical operator “and”

The below picture explains how it could be done.

Office 2013 x64 and Office 2016 collection

Or you can use WQL query like below .

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_ADD_REMOVE_PROGRAMS_64 on SMS_G_System_ADD_REMOVE_PROGRAMS_64.ResourceID = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS_64.ProdID like "{90160000-0011-0000-1000-0000000FF1CE}" and SMS_G_System_ADD_REMOVE_PROGRAMS_64.ProdID like "{90150000-0011-0000-1000-0000000FF1CE}"

The outcome is that you will have collection that gives you insight what computers have Office 2010 and 2016 installed. Below you can see picture with results.

Collections with different query in place.

Hope it will help someone.


One thought on “Combining multiple queries in one collection – SCCM”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.