I have a list of computer names stored in an vbscript array and need check whether these have an object in SCCM or not.
I have tried using a query similar to: set accounts = sQbemServices.ExecQuery("select * FROM SMS_R_System WHERE name = '" & testForName & "'") 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.
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.