oh i thought WQL didn't work.
it turns out it works, SCCM was to blame
SCCM collection by name with multiple conditions
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
-
Vasilyev Sergey 96 Reputation points
2020-08-25T14:30:05.08+00:00
2 additional answers
Sort by: Most helpful
-
Garth Jones 2,076 Reputation points
2020-08-25T12:56:58.703+00:00 And exactly what isn't working?
-
AllenLiu-MSFT 45,686 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.