469,647 Members | 1,719 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,647 developers. It's quick & easy.

Software Inventory Database

I found a vbscript on vbskrypt.com that allows me to inventory the software installed on my computer and puts it in an Access database.

problem:
the script only finds those programs installed by Windows Installer - nothing else.

objective:
i want to expand the quality of the script to be able to find ALL programs as they are listed in Add/remove programs. part of the script includes the search location as "Win32 Product"...I think that is all that has to be changed in order to search a larger scope, but obviously i am at a loss

i googled this and found nothing - if anyone can give me a hand i would really appreciate it.

THIS IS NOT MY SCRIPT - I AM NOT TAKING ANY CREDIT FOR IT


'================================================= =========================
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 4.0
'
' NAME: SoftInv.vbs
'
' AUTHOR: Todd Fields , *
' DATE : 2005/12/19
'
' COMMENT: Creates a software inventory database
'
'================================================= =========================
Option Explicit

' Declare the constants for the database connection
Const adOpenStatic = 3
Const adLockOptimistic = 3

' Declare the variables
Dim sComputer
Dim oNet, oWMI, oSoftware
Dim cnSoftInv, rsData
Dim colSoftware

' This computer
sComputer = "."

' Create an instance of the Network object
Set oNet = CreateObject("WScript.Network")

' Connect to the WMI provider
Set oWMI = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & sComputer & "\root\cimv2")

' Query the Win32_Product namespace
' to get a collection of the software
Set colSoftware = oWMI.ExecQuery _
("SELECT * FROM Win32_Product")

' Create an instance of the ADODB Connection object And
' an instance of the Recordset object
Set cnSoftInv = CreateObject("ADODB.Connection")
Set rsData = CreateObject("ADODB.Recordset")

' Set the connection String
cnSoftInv.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "User ID=Admin;Data Source=U:\network_admin\database_play\softwareinv. mdb"

' Open the connection
cnSoftInv.Open

' Open the data table
rsData.Open "software", cnSoftInv, adOpenStatic, adLockOptimistic

For Each oSoftware in colSoftware
' Add an empty row to the recordset
rsData.AddNew

' Update the fields in the empty row
' with software inventory data
rsData.Fields("ComputerName").Value = oNet.ComputerName
rsData.Fields("Caption").Value = oSoftware.Caption
rsData.Fields("Description").Value = oSoftware.Description
rsData.Fields("IdNum").Value = oSoftware.IdentifyingNumber
rsData.Fields("InstallLocation").Value = oSoftware.InstallLocation
rsData.Fields("InstallState").Value = oSoftware.InstallState
rsData.Fields("InstallDate").Value = oSoftware.InstallDate
rsData.Fields("Name").Value = oSoftware.Name
rsData.Fields("PackageCache").Value = oSoftware.PackageCache
rsData.Fields("SKUNumber").Value = oSoftware.SKUNumber
rsData.Fields("Vendor").Value = oSoftware.Vendor
rsData.Fields("Version").Value = oSoftware.Version

' Update/save the row to the recordset
rsData.Update
Next

' Close and reset the recordset object
rsData.Close
Set rsData = Nothing

' Close and reset the connection object
' This will also close any open recordsets
cnSoftInv.Close
Set cnSoftInv = Nothing
Nov 27 '06 #1
6 5264
NeoPa
32,203 Expert Mod 16PB
Assuming from your question, that the Access concepts are happily handled and you just need information as to how to access the information that you want to populate the database with, I'm going to move this thread to the VB forum, in the hope that someone there will have experience in this matter.
Nov 27 '06 #2
the information IS properly outputted to the Access table, but I want it to gather more than just the information in the Win32 Product name space.
Nov 29 '06 #3
sashi
1,754 Expert 1GB
the information IS properly outputted to the Access table, but I want it to gather more than just the information in the Win32 Product name space.
Hi there,

In order to be able to gather more information you need to know a little bit of Windows Management Instrumentation (WMI) magic, check out MSDN, there are tonnes of notes on WMI, hope it helps. Good luck & Take care.
Nov 29 '06 #4
i'll try that - thanks
Nov 29 '06 #5
if anyone is looking for a great "tutorial" on WMI, they can check this site from MSDN - thanks again for suggesting it. i'm much closer to figuring out what it is i have to do...

http://msdn2.microsoft.com/en-us/library/ms974579.aspx
Nov 29 '06 #6
sashi
1,754 Expert 1GB
if anyone is looking for a great "tutorial" on WMI, they can check this site from MSDN - thanks again for suggesting it. i'm much closer to figuring out what it is i have to do...

http://msdn2.microsoft.com/en-us/library/ms974579.aspx
Hi there,

It's a great link, thanks a million to you. Good luck & Take care.
Nov 30 '06 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Oleg | last post: by
5 posts views Thread by gregork | last post: by
2 posts views Thread by pkfloyd | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.