Working with WMI from vb6
I was the one who asked some days ago about determining hardware in my PC using vb6.
Now i'm trying to do that using WMI but something isn't working...
in the projects MS WMI Scripting V1.1 Library reference was added.
There is a combobox to retrieves the results.
But the problem is that just a few characteristic are retrieve as the following:
Caption: Placa Base
CreationClassName: Win32_BaseBoard
Description:Placa Base
HostingBoard: Verdadero
Name:PlacaBase
PoweredOn: Verdadero
Tag:BaseBoard
Don't retrives the others characteristic.
What's wrong with this?
Please can somebody guide me?, i'm really a beginner
Thanks
the code is as follow:
Private Sub Command1_Click()
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_BaseBoard", , 48)
With Combo1
For Each objItem In colItems
.AddItem "Caption: " & objItem.Caption
.AddItem "ConfigOptions: " & objItem.ConfigOptions
.AddItem "CreationClassName: " & objItem.CreationClassName
.AddItem "Depth: " & objItem.Depth
.AddItem "Description: " & objItem.Description
.AddItem "Height: " & objItem.Height
.AddItem "HostingBoard: " & objItem.HostingBoard
.AddItem "HotSwappable: " & objItem.HotSwappable
.AddItem "InstallDate: " & objItem.InstallDate
.AddItem "Manufacturer: " & objItem.Manufacturer
.AddItem "Model: " & objItem.Model
.AddItem "Name: " & objItem.Name
.AddItem "OtherIdentifyingInfo: " & objItem.OtherIdentifyingInfo
.AddItem "PartNumber: " & objItem.PartNumber
.AddItem "PoweredOn: " & objItem.PoweredOn
.AddItem "Product: " & objItem.Product
.AddItem "Removable: " & objItem.Removable
.AddItem "Replaceable: " & objItem.Replaceable
.AddItem "RequirementsDescription: " & objItem.RequirementsDescription
.AddItem "RequiresDaughterBoard: " & objItem.RequiresDaughterBoard
.AddItem "SerialNumber: " & objItem.SerialNumber
.AddItem "SKU: " & objItem.SKU
.AddItem "SlotLayout: " & objItem.SlotLayout
.AddItem "SpecialRequirements: " & objItem.SpecialRequirements
.AddItem "Status: " & objItem.Status
.AddItem "Tag: " & objItem.Tag
.AddItem "Version: " & objItem.Version
.AddItem "Weight: " & objItem.Weight
.AddItem "Width: " & objItem.Width
Next
End With
End Sub
Re: Working with WMI from vb6
Download Scriptomatic V2 from MS, its free, and it will generate the wmi code for you in vb script. Then its so easy to convert to vb.
Not all properties are filled in by the hardware manufacturer. So some if not most will be blank. usually the important ones will be populated.