title: Checking whether an object exists in SCCM using vbScript
body: <p>I have a list of computer names stored in an vbscript array and need check whether these have an object in SCCM or not.  </p>
  
  <p>I have tried using a query similar to:
  <strong>set accounts = sQbemServices.ExecQuery("select * FROM SMS_R_System WHERE name = '" &amp; testForName &amp; "'")</strong>    to look through SCCM.  This works ok as long as the computer names are valid, but once it reaches an invalid name, it seems to stop.  I have tried outputting the error number, but this always returns a '0' and checking if the result is null, but this doesn't work.</p>
  
  <p>Is this the best way to check that a computer object exists and, if so, can anyone tell me what I'm doing wrong please?  If not, any pointers would be much appreciated.</p>