Sys Buddies (I.T. Folks — Helping Each Other)
September 06, 2010, 04:26:08 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Contact Login Register  

Del.icio.us Digg FURL FaceBook Stumble Upon Reddit SlashDot

Pages: [1]
  Print  
Author Topic: VBS WMI function that returns the version (if any) of a given file  (Read 754 times)
Dave Bauer
Custom Title
Administrator
Newbie
*****
Posts: 26



View Profile
« on: January 13, 2008, 12:12:45 AM »

' Feed this function the explicit path of your file
' Example:
'     msgbox getVersion("C:\program Files\YadaYadaYada\file.exe")

function getVersion(argFile)
   argFile = replace(argFile, "\", "\\")
   set oNet = WScript.CreateObject("WScript.Network")
   computerName = oNet.ComputerName
   Set oWMI = GetObject( "winmgmts://" & computerName & "/root/cimv2" )
   Set oFiles = oWMI.ExecQuery( "Select * from CIM_Datafile WHERE name = '" & argFile & "'")
   for each oFile in oFiles   
      getVersion = oFile.Version
      exit for
   next
   set oNet   = nothing
   set oWMI   = nothing
end function
« Last Edit: January 13, 2008, 12:26:25 AM by Dave Bauer » Logged

Some days your the bug -- Some days your the windshield
Sys Buddies (I.T. Folks — Helping Each Other)
« on: January 13, 2008, 12:12:45 AM »

 Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks
| Sitemap | Privacy Policy
Valid XHTML 1.0! Valid CSS!