Hi,
I'm currently writing a WMI application to retrieve information from a remote machine.
As part of this, I'd quite like to create the "core" of the application without any of the WMI querys etc in the app, but rather have them called from an external database, so that extra functions could be added just by adding records to the database.
This leaves me with one problem - How do I convert a string to an objects name.
Heres my code:
The bits I need to retrieve would be the wmi string, the wmi sql query (both of which i have no problems doing), but how would I convert a string which says "Caption" into the objCurrentClass.caption object?
Thanks.
Jeff.
I'm currently writing a WMI application to retrieve information from a remote machine.
As part of this, I'd quite like to create the "core" of the application without any of the WMI querys etc in the app, but rather have them called from an external database, so that extra functions could be added just by adding records to the database.
This leaves me with one problem - How do I convert a string to an objects name.
Heres my code:
Code:
Dim objWMI
Dim colCurrentClass
Dim objCurrentClass
Dim strComputer As String
Dim intTotalMemory As Integer
strComputer = Me.TextBox2.Text
objWMI = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
colCurrentClass = objWMI.ExecQuery("Select * from Win32_CDROMDrive")
For Each objCurrentClass In colCurrentClass
TextBox1.Text = TextBox1.Text & vbCrLf & "CDROM:" & vbCrLf
TextBox1.Text = TextBox1.Text & vbCrLf "Caption:" & objCurrentClass.caption
Next
Thanks.
Jeff.