On Thu, Jan 28, 2010 at 6:08 PM, Simon Mbuthia <simon.mbuthia@gmail.com> wrote:
Hi guys,

Any VBS/WMI gurus out there? I'm trying to run a script that'll return a list of all COM objects beginning with the word "datac". So my script looks as below:

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\.\root\cimv2")

Set ClassCollection = objWMIService.ExecQuery("SELECT * FROM Win32_ClassicCOMClassSetting where Description like 'Datac%'")

For Each item In ClassCollection
    WScript.Echo item.Name

    WScript.Echo item.Description
Next
 
 
@Simon, thnks for the question as it helps understand WMI better. I covered WMI early last year ( with C sharp ) and I can see that the problem is with the Query string : Win32_ClassicCOMClassSetting does not have a property 'Datac%'.
Class Win32_ClassicCOMClassSetting has 26 proproerties such as AppID, Control etc but not what you used.
 
I could be wrong, pls check your select query. :-)