Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Trying to create a report to find PCs that DO NOT have a particular local user account but it returns all PCs

I must be doing something very non-smart.  My report is simple: 

One column, computer name. 

Filters <all>:

   Computer name does not contain <string I don't want>

   Local User name does not equal <local account name>

Like the subject says, this returns all PCs matching the computer name filter, but seems to ignore the local user name filter.

Interestingly, if I change the local user name filter to "equals" <local account name> then it only returns PCs that do in fact have that user.  I want the PCs that do not have the user.

 

Have also tried "does not contain" with the same result.

1

Comments

2 comments
Date Votes
  • Cory,

    These filters get confusing when you're dealing with data in different tables that have a one-to-many relationship with computers. Your query, as structured, is returning all computers whose names that do not contain <string I don't want> AND where ALL of the computer's local user accounts do not equal <local account name>. Obviously that's not a very useful query because most computers have more than one local user name, so that second filter will basically always be true and does nothing.

    Try this instead:

    Filters <all>:

       Computer name does not contain <string I don't want>

       <Not Any>

          Local User name equal <local account name>

    3
  • Ah yes the "only find devices where one item in an array is not X" issue. Because it evaluates all of the array, one of them will not be X, so all devices will be returned.

    One option: pull out the criteria for what you want to exclude - "local user name filter to "equals" <local account name>" - and then set that as criteria on a dynamic collection. We'll call this "HasLocalUserVVV"

    Then, create another dynamic group group where criteria is NOT CollectionMember of "HasLocalUserVVV". Then you do your report from there (just have to make sure the parent collection is what you want based on the compnames).

    Or, maybe this, can't recall if this works - I usually use the former method as collection membership turns out to be necessary when these queries come up...

    ALL
    |--- RULE: Computer name does not contain <string I don't want>
    |--- NOT ANY
    ____ |--- RULE: Local User name equals <local account name>
    1