From Devx
http://www.devx.com/GetHelpOn/10MinuteSolution/16914/0/page/1
From Manny:
Not the most elegant, but I use ADO to dump a XML recordset to a file. This example only dumps those products installed using MSInstaller. Copy the code below and add it to your VBS file. I'll try to make the same thing work with information from the article above.
Option Explicit
Err.Clear
On Error Resume Next
Dim refLocator
Dim refWMI
Dim sOutputPath ' As string
sOutputPath = "c:\temp\ProductList.xml"
Dim colSoftware
Dim refSoftware
Dim DataList
Const adVarChar = 200
Const MaxCharacters = 255
WScript.Echo "Collecting Product Data"
'connect to WMI with an SWbemLocator
Set refLocator = CreateObject("WbemScripting.SWbemLocator")
Set refWMI = refLocator.ConnectServer()
'retrieve a collection of installed software in the usual way
Set colSoftware = refWMI.ExecQuery("Select * from Win32_Product")
Set DataList = CreateObject("ADOR.Recordset")
DataList.Fields.Append "Vendor", adVarChar, MaxCharacters
DataList.Fields.Append "Name", adVarChar, MaxCharacters
DataList.Fields.Append "Version", adVarChar, MaxCharacters
DataList.Open
For Each refSoftware in colSoftware
DataList.AddNew
DataList("Vendor") = refSoftware.Vendor
DataList("Name") = refSoftware.Name
DataList("Version") = refSoftware.Version
DataList.Update
Next
DataList.Sort = "Vendor, Name"
DataList.MoveFirst
WScript.Echo "Saving to " & sOutputPath
DataList.Save sOutputPath,1
WScript.Echo "Finished Saving to " & sOutputPath
Set colSoftware = Nothing
Set refWMI = Nothing
Set refLocator = Nothing
Set DataList = Nothing