vbscript to verify application version

This issue has been solved. See solution.
pragmmativco's picture

Hi there,

I am looking how to run a vbscript from Deployment Console (6.9), which will check if  version "C:\Program Files\Mozilla Firefox\firefox.exe" is equal or less than 3.0.4, then run firefox.exe (3.0.10)

I was trying to test
 
"Function GetOfficeVersion(strComputer)
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMI.ExecQuery( _
"SELECT Version FROM Win32_Product WHERE Name Like ' ")"

but I could not go anywhere, because of my basic vbscript knowledge, if you have any sample I will appreciate if you could share it...thanks

mlombardo's picture

Try this: 'vbscript dim

Try this:

'vbscript
dim verNum
Set objFSO = CreateObject("Scripting.FileSystemObject")

verNum= objFSO.GetFileVersion("C:\Program Files\Mozilla Firefox\firefox.exe")

If Left(verNum,5)<3.0.5 then <path_to_executable>

Visit my Altiris Blog at mikelombardo.net

Biohazzard's picture

I like how that counted the

Solution

I like how that counted the charactors over. ...Or you could do this:

'vbscript
dim file1
dim version

FILE1 = "C:\Program Files\Mozilla Firefox\firefox.exe"
version = ("3.0.4")
Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.GetFileVersion(FILE1) < version Then
WshShell.run(path to executable)

end if
 

pragmmativco's picture

file version

Thanks for the hints, much appreciated

I tried If Left(verNum,5)<3.0.5 then <path_to_executable>, but I got error , Line 7 char 22 expected Then, but I did not know how to fix it sorry

I tried If objFSO.GetFileVersion(FILE1) < version Then WshShell.run(path to executable). for this one I needed to add Set WshShell  and it worked fine

thanks for your help....