This VBS script will allow you to enter an SMS server name and site code as well as a machine name from a series of input dialog boxes. It will then look in the collection specified and determine if the machine name exist in the collection.
VBS Script:
strComputer = InputBox ("Enter SMS Server Name")
strSiteCode = InputBox ("Enter Site Code")
strResource = InputBox ("Enter Machine Name")
Set objWMIService = GetObject("winmgmts://" & strComputer & "\root\sms\site_" & strSiteCode)
' SMS_CM_RES_COLL_SMS00001 Is The All Systems Collection Change As Needed
Set colItems = objWMIService.ExecQuery("Select * From SMS_CM_RES_COLL_SMS00001 Where Name ='" & strResource & "'")
If colItems.Count > 0 Then
MsgBox UCase(strResource) & " Exist In The Collection"
Else
MsgBox UCase(strResource) & " Was Not Found In The Collection"
End If
No Comments