Exclude Computers by Name from SCCM collection

I'm trying to create a SCCM collection with all systems EXCEPT three named computers, by compture name.  I need this to prevent JAVA updates on some systems that need specific versions.

I have tried-
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 inner join SMS_G_System_SYSTEM on SMS_G_System_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_SYSTEM.Name != "netbiosname"

Open in new window


I have tried -
 
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 inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.Name != "netbiosname"

Open in new window


the statements do not prevent "netbiosname" from appearing in the collection.
whoamAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
what's the value of "Name" in table: SMS_G_System_COMPUTER_SYSTEM?

have you tried:
select a.ResourceID,a.ResourceType,a.Name,a.SMSUniqueIdentifier,a.ResourceDomainORWorkgroup,a.Client 
from SMS_R_System a inner join SMS_G_System_COMPUTER_SYSTEM b on b.ResourceID = a.ResourceId 
where b.Name <> "netbiosname"

Open in new window

or
select a.ResourceID,a.ResourceType,a.Name,a.SMSUniqueIdentifier,a.ResourceDomainORWorkgroup,a.Client 
from SMS_R_System a inner join SMS_G_System_COMPUTER_SYSTEM b on b.ResourceID = a.ResourceId 
where b.Name not like "%netbiosname%"

Open in new window


?
whoamAuthor Commented:
both suggestions showed syntax errors
Thought it was carriage returns, removed them, but still had issues.
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
what's the syntax error you get? which SQL statement you referring to?
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

whoamAuthor Commented:
I tried both, when I went to save either back to SCCM it simply stated there was a syntax error.
whoamAuthor Commented:
I'm sorry I can't be more speciifc but the system did not provide more information
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
i'm not doing much in SCCM, may I know where you executing your SQL query?

1. what if you removing the "Where" criteria, will it return with an error?

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 inner join SMS_G_System_SYSTEM on SMS_G_System_SYSTEM.ResourceId = SMS_R_System.ResourceId

Open in new window

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 inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId

Open in new window


2. Are the objects valid for:

SMS_R_SYSTEM
SMS_G_System_COMPUTER_SYSTEM
?
whoamAuthor Commented:
for whatever reason, I removed the collection, copied and pasted the first line above, and it worked.

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 inner join SMS_G_System_SYSTEM on SMS_G_System_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_SYSTEM.Name != "netbiosname"
                               
Obviously I changed "netbiosname" to the name to exclue
whoamAuthor Commented:
Oh, the querry is executed in SCCM in the collection build or membership rules area.
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
ok, glad that there's progress in your work! so do you need further helps here or you can try to close the question. if you think you find the answer yourself you can raise a request to close it with PAQ 0 pts.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.