newbie problem - how do I get dll version & size?
- From: Tcs <TSmithATEastPointCityDOTorg>
- Date: Thu, 25 Aug 2005 12:14:13 -0400
My original post from yesterday in microsoft.public.windowsxp.wmi. Since I've
received no response, I'll try here.
============================================================================
I have a bunch of machines on which I need to check .dll revisions. I'm trying
to write a simple(?) script to do this. here's what I have so far:
'---------------------------------------------------------------------------
strComputer = "."
Set objFSO = CreateObject("Scripting.FileSystemObject")
strNames = & _
"c:\winnt\regedit.exe," & _
"c:\winnt\explorer.exe"
arrNames = Split(strNames, ",")
Wscript.Echo Ubound(arrNames) + 1
Set objTextFile = objFSO.CreateTextFile("IT-DBAdmin_Jet_40_SP8_files.txt")
Do While NOT Ubound(arrNames) = ""
Wscript.Echo "(regedit.com)...(" & _
objFSO.GetFileVersion("c:\winnt\regedit.exe") & ")" & _
objFSO.FileSize("c:\winnt\regedit.exe") & ")"
Wscript.Echo "(explorer.exe)...(" & _
objFSO.GetFileVersion("c:\winnt\explorer.exe") & ")" & _
objFSO.FileSize("c:\winnt\explorer.exe") & ")"
Loop
objTextFile.Close
'---------------------------------------------------------------------------
And of course it doesn't work. I would *like* to set up an array of the
filenames I want info on, then cycle thru them until the list is finished. I'd
*also* like to write this info out to a file.
You can see that I have "pieces", just not the whole thing, plus my DO loop
isn't good. And my 'objFSO.FileSize' doesn't work as well. (Geez. But hey, I
only started with this wmi scripting about 2 hours ago... Really.) If i can't
cycle thru an array of the names I need, how would I set a path, so I cane save
some typing? (Since a lot of these are in the same place, such as
"C:\Winnt\system32".)
If anyone could "fill in the gaps", or point me to some where I might find what
I'm after, I'd appreciate it.
Thanks in advance,
Tom
============================================================================
Since then I've made mods to this:
My input file:
c:\Program Files\Common Files\Microsoft Shared\DAO,Dao360.dll,3.60.8025.0,557328
c:\winnt\system32,Expsrv.dll,6.0.72.9589,380957
c:\winnt\system32,Msexch40.dll,4.0.6807.0,512272
c:\winnt\system32,Msexcl40.dll,4.0.8015.0,303376
c:\winnt\system32,Msjet40.dll,4.0.8015.0,1507600
c:\winnt\system32,Msjetoledb40.dll,4.0.8015.0,348432
c:\winnt\system32,Msjint40.dll,4.0.6508.0,151824
c:\winnt\system32,Msjter40.dll,4.0.6508.0,53520
c:\winnt\system32,Msjtes40.dll,4.0.8015.0,241936
c:\winnt\system32,Msltus40.dll,4.0.6508.0,213264
c:\winnt\system32,Mspbde40.dll,4.0.8015.0,356624
c:\winnt\system32,Msrd2x40.dll,4.0.7328.0,422160
c:\winnt\system32,Msrd3x40.dll,4.0.6508.0,315664
c:\winnt\system32,Msrepl40.dll,4.0.8015.0,553232
c:\winnt\system32,Mstext40.dll,4.0.8015.0,258320
c:\winnt\system32,Mswdat10.dll,4.0.6508.0,831760
c:\winnt\system32,Mswstr10.dll,4.0.6508.0,614672
c:\winnt\system32,Msxbde40.dll,4.0.8025.0,360720
c:\winnt\system32,Vbajet32.dll,6.0.1.9431,30749
My script:
strComputerName = "."
Const ForReading = 1
intFilesToChk = 19
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile1 = objFSO.OpenTextFile("Jet_40_SP8_Files.txt", ForReading)
Set objTextFile2 = objFSO.CreateTextFile("ITGUY_Jet_40_SP8_files.txt")
Wscript.Echo " " & _
" Filename version filesize "
Wscript.Echo " " & _
"-----------------------------------------------------------"
'
' first show me what I'm *supposed* to have
'
For L1 = 1 to intFilesToChk Step 1
If inStr(objTextFile1.Readline, ",") Then
arrDLLRec = split(objTextFile1.Readline, ",")
Wscript.Echo "(" & _
arrDLLRec(0) & ")..(" & _
arrDLLRec(1) & ")..(" & _
arrDLLRec(2) & ")..(" & _
arrDLLRec(3) & ")"
Else
objTextFile1.Skipline
End If
i = i + 1
Next
objTextFile1.Close
objTextFile2.Skipline
Set objTextFile1 = objFSO.OpenTextFile("Jet_40_SP8_Files.txt", ForReading)
'
' now show me what's actually on this machine
'
For L1 = 1 to intFilesToChk Step 1
If inStr(objtextFile1.Readline, ",") Then
arrDLLRec = split(objTextFile1.Readline, ",")
Set objFile = objFSO.GetFile(arrDLLRec(0) & "\" & arrDLLRec(1))
' Wscript.Echo "(" & _
' objFile.Name & ")..(" & _
' objFile.Version & ")..(" & _
' objFile.size & ")"
Wscript.Echo "(" & _
objFile.Name & ")..(" & _
objFSO.GetFileVersion(arrDLLRec(0) & "\" & arrDLLRec(1)) & ")..(" &
_
objFile.Path & ")..(" & _
format(int(objFile.size), "#,##0") & ")"
Else
objTextFile1.Skipline
End If
i = i + 1
Next
objTextFile1.Close
objTextFile2.Close
Problem #1.) Line 1 of my input file seems to be skipped. Perhaps because of
the several spaces in the path? How do I fix it? (Enclosing the path in quotes
didn't help.)
Problem #2.) Line 19, Char 9, Subscript out of range: '[number: 0]'. This
occurs after displaying the next to the last line of the input file.
ALTHOUGH...when I see it, this line is only the 9th filename I've seen, not the
18th, as it should be.
Problem #3.) I took out line 1 of my input file, so I could see if the space
affected the result. Problem #2 disappeared. But now I have another. 'Input
past end of file.' Even if I reduce my counter, I still get this. I've reduced
my counter to 15, but I still get an error when I try to read the 10th record.
Problem #4.) When the line number is reported, does this mean the 'actual' line
number of the script, including blank lines? Or just the line number of lines
with code?
Sorry for the looong post, and so many questions. I'm just getting started with
this wmi scripting and have no one else to ask. Thanks for your indulgence.
Thanks in advance,
Tom
.
- Follow-Ups:
- Prev by Date: Re: End of String Character?
- Next by Date: Re: Finding if a file does not exist
- Previous by thread: Pushing onto an array
- Next by thread: RE: newbie problem - how do I get dll version & size?
- Index(es):
Relevant Pages
|