SCCM query help

Hi

I'm having trouble with an SCCM query not returning the correct information.

I'm trying to do a dynamic collection of computers based on their hostname. My computers are named LIB-<Building>-<number>

Examples: LIB-HSS-01, LIB-BUS-15

What I am trying to do is get a list of all computers in a building. So I've run the SMS query below but I don't get any results. Can someone please point me in the right direction fo where I am going wrong.

The criteria I set up to generate the query was "System Resource.Name uppercase is equal to "%BUS%""

Regards

Mat




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 UPPER(SMS_R_System.Name) = "%BUS%"

Open in new window

LVL 1
it-servicesAsked:
Who is Participating?
 
matrixnzConnect With a Mentor Commented:
You need to use "Like" not "=" otherwise the WildCard "%" is seen as a real identifier.

Hope that made sense.

Cheers
0
 
matrixnzCommented:
Also I assume that BUS isn't inside the name by default but you could be more specific, also wouldn't worry about the upper.  Use something like
"LIB-BUS-%" this makes it more specific

Cheers
0
 
it-servicesAuthor Commented:
Thanks Matrixnz that has worked
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.