Software and Hardware Inventory

G

Guest

Hi,

There are some good extensive samples or components that make software and hardware inventory with WMI easy

I'm seeking some examples or WMI class/property listing to catch the components in the machine that mades up a good software/hardware inventory.

Regards
Lucas Ponzo
 
K

Ken Tucker [MVP]

Hi,

Add a reference to system.management.dll

Private Sub GetDevices()
Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_PnPEntity")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format("{0} - Status {1}", mo("Name").ToString,
mo("Status").ToString)
Trace.WriteLine(strOut)
Next
End Sub

Private Sub GetInstalledSoftware()
Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_SoftwareFeature")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format("{0} - {1}", mo("productName").ToString,
mo("Vendor").ToString)
Trace.WriteLine(strOut)
Next
End Sub

Ken
 
G

Guest

Thanks,

Very usefull this sample code. But more one question:

I search the documentation of the ManagementObjectSearcher and didn't saw the complete list of the "tables" that I can select from it. Win32_SoftwareFeature, Win32_PnPEntity ... etc ...

Can you indicate me in what documentation can I find it ?

Thanks
Lucas Ponzo.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top