Software and Hardware Inventory

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
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.
 
Back
Top