Using perl and wmi to get MS file version info

K

kngnsm

As anyone figured out how to get the file version info of a *specified
file* using perl and wmi?

Scriptomatic gives you the following but returns every file from the
directory WINNT - I want to be able to specify the file I whose info I
want.

On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from
Win32_FileSpecification",,48)
For Each objItem in colItems
Wscript.Echo "Attributes: " & objItem.Attributes
Wscript.Echo "Caption: " & objItem.Caption
Wscript.Echo "CheckID: " & objItem.CheckID
Wscript.Echo "CheckMode: " & objItem.CheckMode
Wscript.Echo "CheckSum: " & objItem.CheckSum
Wscript.Echo "CRC1: " & objItem.CRC1
Wscript.Echo "CRC2: " & objItem.CRC2
Wscript.Echo "CreateTimeStamp: " & objItem.CreateTimeStamp
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "FileID: " & objItem.FileID
Wscript.Echo "FileSize: " & objItem.FileSize
Wscript.Echo "Language: " & objItem.Language
Wscript.Echo "MD5Checksum: " & objItem.MD5Checksum
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "Sequence: " & objItem.Sequence
Wscript.Echo "SoftwareElementID: " & objItem.SoftwareElementID
Wscript.Echo "SoftwareElementState: " &
objItem.SoftwareElementState
Wscript.Echo "TargetOperatingSystem: " &
objItem.TargetOperatingSystem
Wscript.Echo "Version: " & objItem.Version
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top