Demystifying Inventory Queries

Description

Inventory queries are fundamental, both for reporting and Fileset deployment.  For basic details for queries, please take a look at 8.3. Creating and Editing a query

However, if the query isn't correct, then you could end up with incorrect reports or worse still incorrect Fileset deployments or removals.

Information

So as well as the above section of the guide, additionally there are some example queries built into the Admin console: 8.4. Using the Sample Queries

Sometimes though, you need that something that is a little more complex or you can't quite get the right results.  Some consideration when making queries:

  • Do you need the query
  • Does the criteria match the desired expectation
  • What Main Component should be used
  • What Fields do you really need present

Following are some examples to demonstrate this.

  1. Devices that do not have an application installed
  2. Unexpected Entries
  3. None and Not

1) Devices that do not have an application installed

Do you need the query?  

Seems like an odd question, but why is this required?  If Filesets are associated they should be installed, if not already, at next check in from the device.  If the software has failed, then this is already available through the Report window.  Perhaps they aren't in the right groups to be associated though or maybe the device hasn't checked in for a long time.  Creating a Smart Group based upon an application that is not installed though, will not change the installation status if there is already an association and the App has failed to instal.

Does the criteria match the desired expectation?

In this case we want the devices that do not have an application installed.  Using Firefox on macOS as an Example.

Drag in 'Application' > 'Name' to the criteria and set the following:

  • Application/Name
  • Is
  • Firefox.App

Note we have 'Is' selected.  Selecting Is Not, Does Not Contain, etc will not yield the desired results.  Selecting Is Not for instance, will list all devices that have any application on those devices that is not called Firefox.App.  In essence this will be all devices, those with and those without Firefox.  Instead we tick the Not box.

By using the Not box, it gives the reverse of the query.  List all the devices that have Firefox and then give the opposite result (based upon Main Component, which will be covered next).

Since this is a MacOS query, then additionally the OS Type can be added:

  • OS Type
  • Is
  • macOS

What Main Component should be used?

The main component is the key ingredient that the criteria will be based upon.  Imagine two fields: FileWave Client Name and Application > Name

With the main component set to Application, the query will be:

  • Show all Applications that are not Firefox.App

A query set up this way will therefore show all devices, as any App that is not Firefox.App will be a successful hit on this search

With the main component set to macOS/Windows Device, then the query will be:

  • Show all devices that do not have Firefox.App

This will be a different set of results, as now any device that has Firefox installed will no longer show.  This is the desired result.

What Fields do you really need present?

The above has given the desired result, but there are multiple entries per device.  From a Smart Group associations point of view, strictly speaking this should not matter.  There is only one of each device in reality, but it makes it hard to read and does not work well as an Inventory Query for reporting.  As such, removing any relationship that will create a 1:many relationship would be ideal, such that there is only one result per device.

2) Unexpected Entries

Sometimes there are entries that seem unexpected.  This is usually related to one of the query items in the last example not set as actually expected.  From the last example, changing the Main Component to Application will still have an undesired result, as this will be searching the criteria against Application entries in the database even though that Field is not shown.  There will still only be one entry visible per device, but the search is now listing all Applications that are not Firefox, so every device.

It is possible though, with incorrect Main Component and certain fields added, the output can appear confusing.  Start with a fresh Inventory query and by setting the following, many entries can be seen with no FileWave Client Name:

  • No Criteria
  • Add FileWave Client Name as a Field
  • Add Operating System as a Field (by dragging this in, all sub inventory items for Operating System will be added to the Fields view).

With the Main Component set as Operating System, there will be many entries with no FileWave Client Name.

This will be because entries have been made into the database from machines running these OS versions that are no longer appropriate for any of the active devices.  Again, by changing the Main Component, this can provide a true representation of current installed OS versions.

Saving the above with the Main Component set as Operating System these entries can be seen to have no client.  Right click on an entry.  As well as Copy, is there the option to Reveal Client:

If there is no Client to Reveal, then there is no representable entry in the database.  If you have a FileWave Client Name that shows, but does not have the option to Reveal Client, it may be an old static record which will require manual removal.  In this instance you could contact support and they would be able to assist tidying this up.

Inventory Only and Archived Clients

When attempting to Reveal Clients, if the client is either Inventory Only or Archived, the relevant option to view these would need to be set through the contextual Menu Item


3) None and Not

Not can in many instances be more useful.  A question was posed:

"We would like an Inventory query to show devices that have multiple specific Filesets installed? The issue I am seeing is that if you try to enter multiple Fileset IDs to an inventory query it will show no results because I am guessing it is trying to look for every Fileset to have multiple IDs. So basically I want to find a device that has Fileset 1, 2, and 3, installed and they must have all 3 to go in to the query."

Taking from the information above, the negative logic will be seen to be the approach.  Trying to search for each of these using positive logic will again not yield the correct results.  Instead, Not can be used with desired results when mixed with None.

Take some time to think about how this works.  Understanding of this will make Inventory Query building in general more successful and ensure you don't have unexpected results.