New to VBS and probably having difficulty because of having used VBA.
Anyway I'm attempting to write a script to Enumerate software loaded on the
local PC and save it in an Excel Spreadsheet. And I gues my counter i = 2
and then most, of all, stepping i + 1 doesn't work with VBS.

Any ideas on how I can do this? If you try the script, note the
"C:\Scripts\EnumInstSW.xls"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\Scripts\EnumInstSW.xls")

strComputer = "."
objExcel.Visible = True
objExcel.Workbooks.Add

objExcel.Cells(1, 1).Value = "Caption"
objExcel.Cells(1, 2).Value = "Description"
objExcel.Cells(1, 3).Value = "Identifying Number"
objExcel.Cells(1, 4).Value = "Install Date"
objExcel.Cells(1, 5).Value = "Install Location"
objExcel.Cells(1, 6).Value = "Install State"
objExcel.Cells(1, 7).Value = "Name"
objExcel.Cells(1, 8).Value = "Package Cache"
objExcel.Cells(1, 9).Value = "SKU Number"
objExcel.Cells(1, 10).Value = "Vendor"
objExcel.Cells(1, 11).Value = "Version"

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
("SELECT * FROM Win32_Product")

i = 2

For Each objSoftware in colSoftware
objExcel.Cells(i, 1).Value = objSoftware.Caption
objExcel.Cells(i, 1).Value = objSoftware.Description
objExcel.Cells(i, 1).Value = objSoftware.IdentifyingNumber
objExcel.Cells(i, 1).Value = objSoftware.InstallLocation
objExcel.Cells(i, 1).Value = objSoftware.InstallState
objExcel.Cells(i, 1).Value = objSoftware.Name
objExcel.Cells(i, 1).Value = objSoftware.PackageCache
objExcel.Cells(i, 1).Value = objSoftware.SKUNumber
objExcel.Cells(i, 1).Value = objSoftware.Vendor
objExcel.Cells(i, 1).Value = objSoftware.Version
i + 1
Next

Re: Counters by Keith

Keith
Thu Apr 07 18:58:11 CDT 2005


"Philippe L. Balmanno" <PBalmanno@sandiego.gov> wrote in message =
news:esev2R7OFHA.2384@tk2msftngp13.phx.gbl...

>...
> objExcel.Cells(i, 1).Value =3D objSoftware.Version
> i + 1
> Next=20


use i =3D i +1

Keith

Re: Counters by Philippe

Philippe
Fri Apr 08 08:23:53 CDT 2005

"Keith Miller" <k.miller79@verizon.net> wrote in message
news:Oj#Qn28OFHA.2136@TK2MSFTNGP14.phx.gbl...

"Philippe L. Balmanno" <PBalmanno@sandiego.gov> wrote in message
news:esev2R7OFHA.2384@tk2msftngp13.phx.gbl...

>...
> objExcel.Cells(i, 1).Value = objSoftware.Version
> i + 1
> Next


use i = i +1

Keith

How could I have missed that? Thanks.

--
Philippe L. Balmanno




Re: Counters by Keith

Keith
Fri Apr 08 11:17:08 CDT 2005


"Philippe l. Balmanno" <plb2862@cox.net> wrote in message =
news:e97K44DPFHA.1396@TK2MSFTNGP10.phx.gbl...

> "Keith Miller" <k.miller79@verizon.net> wrote in message
> news:Oj#Qn28OFHA.2136@TK2MSFTNGP14.phx.gbl...
>=20
> "Philippe L. Balmanno" <PBalmanno@sandiego.gov> wrote in message
> news:esev2R7OFHA.2384@tk2msftngp13.phx.gbl...
>=20
> >...
> > objExcel.Cells(i, 1).Value =3D objSoftware.Version
> > i + 1
> > Next
>=20
>=20
> use i =3D i +1
>=20
> Keith
>=20
> How could I have missed that? Thanks.
>=20
> --
> Philippe L. Balmanno
>=20

You're welcome. It's easy to miss little things when you're focused on =
a bigger task. My personal downfall is forgetting to use 'set' with =
object variables.

Keith