By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,696 Members | 1,422 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,696 IT Pros & Developers. It's quick & easy.

Software Inventory Database

P: 65
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
Share this Question
Share on Google+
6 Replies


NeoPa
Expert Mod 15k+
P: 31,489
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

P: 65
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
Expert 100+
P: 1,754
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

P: 65
i'll try that - thanks
Nov 29 '06 #5

P: 65
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
Expert 100+
P: 1,754
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.