Executable Version Checking

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
nathstar
Posts: 3
Joined: Sat Oct 16, 2010 3:28 am

Executable Version Checking

Post by nathstar »

Hi All,

I would like to be able to specify a file path and for Host Monitor to return the version contained within the exe file.

I have been told this is possible, and have had a little help with this, but I am not too familiar with scripting or programming, but really need to get this working.

Any help would be wonderful.

Regards

Nathan
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

You may use Shell Script test method and script like the following

Code: Select all

Option Explicit

const statusAlive       = "scriptRes:Host is alive:"
const statusDead        = "scriptRes:No answer:"
const statusUnknown     = "scriptRes:Unknown:"
const statusNotResolved = "scriptRes:Unknown host:"
const statusOk          = "scriptRes:Ok:"
const statusBad         = "scriptRes:Bad:"
const statusBadContents = "scriptRes:Bad contents:"

dim objFSO, objArgs, filever
Set objArgs = WScript.Arguments

if objArgs.Count<1 then
    WScript.StdOut.Write statusUnknown & "Parameter requited: <Full_path_to_the_file>"
    WScript.Quit
end if

Set objFSO = CreateObject("Scripting.FileSystemObject")
if objFSO.FileExists(objArgs(0)) then
    filever = objFSO.GetFileVersion(objArgs(0))
    if objArgs.Count>1 then
      if filever = objArgs(1) then
        WScript.StdOut.Write statusOk & filever
      else
        WScript.StdOut.Write statusBad & filever
      end if
    else
        WScript.StdOut.Write statusOk & filever
    end if
else
    WScript.StdOut.Write statusUnknown & "File [" & objArgs(0) & "] does not exist."
end if
There are 2 parameters for this script
1) <full path to file>
2) 2nd parameter is optional: <expected file version>

More information regarding Shell Script test method available in the manual, help system and on-line at:
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell

Regards
Alex
nathstar
Posts: 3
Joined: Sat Oct 16, 2010 3:28 am

Post by nathstar »

Alex,

Thanks for the reply. Tom (via email) supplied this script a few days ago.. However as I have very limited knowledge of scripting I have not been able to work out how to use it. Where should I specify the path to the file name?
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Well, you don't need to know much about scripts because we created script for you.
You just need to setup Shell Script test item. How to do this described in the manual (manual in MS Word format included in the package, check manual.doc file located in HostMonitor folder).
Also you may read necessary information on-line, just click on link I provided in my previous answer.
Where should I specify the path to the file name?
When you setup Shell Script test item it allows you to select script and specify parameters.

Regards
Alex
nathstar
Posts: 3
Joined: Sat Oct 16, 2010 3:28 am

Post by nathstar »

Alex,

I have worked out that on the test setup page, I can specify the params.... but I really have no idea what to put in this box. I have tried the path to my file "C:\IPS.exe" and it either returns a result of "script returned no results" or "file not found" depending on how I input this.

Help with what to put in this box would be great :)
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Are you sure you have selected correct script for this test?
Have you read the manual that tells you how to work with Script Manager?
What Windows do you use? Service Pack?
HostMonitor version?

Script may receive one or two parameters
For example:
"c:\ips.exe" "6.1"
or
"c:\ips.exe"

Note1: If there are space characters in the path (e.g C:\Program Files\test.exe), use quotation marks.
Note2: You may try parameters like "C:\Windows\notepad.exe" "6.1.7600.16385" to be sure script is working.

Regards
Alex
Post Reply