SCCM collection by name with multiple conditions

Vasilyev Sergey 96 Reputation points
2020-08-25T12:12:08.24+00:00

i trying select PC with name like "esh" and ("test" or "tst") and not like "2"
this not work - query:
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
where
SMS_R_System.NetbiosName like "%esh%" and
(SMS_R_System.NetbiosName like "%test%" or SMS_R_System.NetbiosName like "%tst%") and SMS_R_System.NetbiosName not like "%2%"

in powershell successfully:
Get-ADComputer -Filter {(name -like "esh" -and (name -like "tst" -or name -like "test") -and name -notlike "2") }|select name

Microsoft Configuration Manager
0 comments No comments
{count} votes

Accepted answer
  1. Vasilyev Sergey 96 Reputation points
    2020-08-25T14:30:05.08+00:00

    oh i thought WQL didn't work.
    it turns out it works, SCCM was to blame


2 additional answers

Sort by: Most helpful
  1. Garth Jones 2,071 Reputation points
    2020-08-25T12:56:58.703+00:00

    And exactly what isn't working?

    0 comments No comments

  2. AllenLiu-MSFT 41,136 Reputation points Microsoft Vendor
    2020-08-26T02:00:40.41+00:00

    Your query can work perfectly, you may just need a refresh when you think it doesn't work after you create the collection.


    If the response is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments