Sunday, February 7, 2010

VBSCRIPT FOR FILE VERSION CHECK

 

Set Fso = CreateObject("Scripting.FileSystemObject")

Set InputFile = fso.OpenTextFile("MachineList.Txt")

Do While Not (InputFile.atEndOfStream)

strComputer = InputFile.ReadLine

 

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colFiles = objWMIService.ExecQuery _
    ("Select * from CIM_Datafile Where Name = 'c:\\windows\\system32\\drivers\\tdx.sys'")
For Each objFile in colFiles
    Wscript.Echo objFile.Version &" " & strComputer
   
    'Wscript.Echo "Version: " & strComputer

Next

loop
-------------------
Thanks,

Marie von Ebner-Eschenbach  - "Even a stopped clock is right twice a day."

1 comment:

lauren said...

Thanks for sharing to VB Script code for checking version of a file.I was searching for same and your code really saved a lot of efforts.Its usually easy to get the code from internet but its not true with VB Script. digital signature PDF