Collection query for executable name and executable path

I'm trying to get a couple collections working, and I'm not making any headway on either one. Basically, the customer has an environment with both Office 2010 and Office 2013 deployed, plus Office 2010 applications on systems with the core Office 2013. So, I need two collections for a couple deployments I need to get scheduled.

First, I need a collection of computers with Office 2013, but without groove.exe (apparently at some time they pushed out Office 2013 without SkyDrive, or they're worried that may be the case, I'm not sure which is true). The collection query I have right now is below, but it's showing 6117 members..the problem is, there are only around 11,000 workstations, and the "Computers with groove.exe" collection I have shows approximately 9519 members (it's just looking for the Installed Executable "groove.exe", and I'm excluding that collection).

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_INSTALLED_EXECUTABLE on SMS_G_System_INSTALLED_EXECUTABLE.ResourceId = SMS_R_System.ResourceId where (SMS_G_System_INSTALLED_EXECUTABLE.ExecutableName like "outlook.exe" and SMS_G_System_INSTALLED_EXECUTABLE.InstalledFilePath like "%office15%")

Second, I need a collection of computers that have Office 2010. And again, some of these computers have core Office 2013, but Office 2010 applications, such as PowerPoint, so I can't just go off of the Add/Remove Programs listing (both show up). Here's the query I'm using now, but again, it's showing 0 members.

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 on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_ADD_REMOVE_PROGRAMS_64 on SMS_G_System_ADD_REMOVE_PROGRAMS_64.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_INSTALLED_EXECUTABLE on SMS_G_System_INSTALLED_EXECUTABLE.ResourceId = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName = "%Microsoft Office Professional Plus 2010%" and (SMS_G_System_INSTALLED_EXECUTABLE.ExecutableName = "outlook.exe" and SMS_G_System_INSTALLED_EXECUTABLE.InstalledFilePath not like "%\"Office 15%\"") and (not SMS_G_System_ADD_REMOVE_PROGRAMS_64.DisplayName = "Microsoft Online Services Sign-in Assistant") order by SMS_R_System.Name

If anyone has any ideas, I would be super grateful...I've been banging my head against these collections all day without any luck.

September 2nd, 2015 3:45pm

You have to use "subselect / not in" if you want to exclude computers (http://www.mssccmfaq.de/2011/07/31/collections-rechner-ohne/) or the 'exclude collection' function in CM12.
Free Windows Admin Tool Kit Click here and download it now
September 2nd, 2015 4:19pm

Correct, for the first collection (Office 2013 computers) I'm using the exclude collection function to exclude the "Computers with groove.exe" collection I created.
September 2nd, 2015 4:29pm

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 on SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_ADD_REMOVE_PROGRAMS_64 on SMS_G_System_ADD_REMOVE_PROGRAMS_64.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_INSTALLED_EXECUTABLE on SMS_G_System_INSTALLED_EXECUTABLE.ResourceId = SMS_R_System.ResourceId where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName = "%Microsoft Office Professional Plus 2010%" and (SMS_G_System_INSTALLED_EXECUTABLE.ExecutableName = "outlook.exe" and SMS_G_System_INSTALLED_EXECUTABLE.InstalledFilePath not like "%\"Office 15%\"") and (not SMS_G_System_ADD_REMOVE_PROGRAMS_64.DisplayName = "Microsoft Online Services Sign-in Assistant") order by SMS_R_System.Name

There are several issue with this query. 

  • Only x64 computer will ever work for this query due to the inner join on its table.
  • You are only looking for x86 version of Office, is that right?
  • You are not joining Installed Executable to ARP data, so this will have interesting results.
  • Your "Not" need to be a subselect query
Free Windows Admin Tool Kit Click here and download it now
September 2nd, 2015 5:35pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics