Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1


Remember Me


0 votes
Current Version
Last Release Date
Compatible With
  • Nagios 3.x
check_software_ver.wsfWSH File using VBScript

Help Support Ethan Galstad's New Project:

Help Support Ethan

A Message From The Founder...

As the founder of Nagios, I'm asking for your help in a cause that's dear to my heart.

I'm launching a new project to help better the world by providing the information, ideas, and inspiration that I believe can improve the lives of people everywhere.

I know you're busy managing networks, but I would appreciate it if you would consider liking my Facebook page and showing your support for the content and messages I produce by sharing them with your friends and family.

You can learn more about my project by visiting Thank you for your time. I wish you all the best in your endeavors, whatever they may be.

- Ethan

This script was written for Nagios/NRPE. It queries Windows WMI for Software Version with optional checks for validation against specific version, plus a mismatch allowance.
This script was written for Nagios/NRPE, and uses WSH/VBScript.

It queries Windows WMI and makes a Software Version Check with optional validation against minimum version, plus a mismatch allowance.

It requires one argument (Package Name - $ARG1$), and you can feed it two optional arguments of a version ($ARG2$) for comparison, and a mismatch allowance ($ARG3$) defining how many figures - starting from the right - can be ignored.

If just $ARG1$ is provided it simply returns the Software/Version. ($ARG1$ can use % as a wildcard for matching.)
If $ARG1$ and $ARG2$ are provided it also makes a strict version check.
If $ARG3$ is also provided it makes a version check according to the leeway provided by the argument. (Number must be 1 less that the component count in the version number provided by $ARG2$. Special Cases are "0", meaning strict check, and 99 meaning any later version is OK.)

Downside: This will only report software that registers itself with WMI. (All MSI Installations should do this, but many self-installers do not.)

Nagios Config:
I personally use a custom command for this, as it takes arguments from the service. I also needed to increase the timeout here (as well as in the Nagios/NRPE/NSClient++ configs) because WMI calls can take some time on old hardware.

define command {
command_name check_nt_software
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -t 300 -c $ARG1$ -a $ARG2$ $ARG3$ $ARG4$

You'll need a service per package, and I'll use a strict check of Flash Player for my example. (I always tend to give the allowance argument, even though it's not technically required when doing a strict check. I use 0 in these cases.)

define service {
service_description check_flash_player
display_name Check Flash Player Version
contact_groups INSERT-GROUPS-HERE
check_command check_nt_software!check_software_ver!%flash%player%!!0
check_interval 10080
notification_interval 10080

Client Requirements:
Windows obviously. (2000 and upwards.)
WMI installed and the Win32_Product Class available. (To check, go to an admin command prompt and type "wmic product". If you see a list of software, it's working.)
NSClient++ (or similar)
Arguments allowed for NRPE.

nsc.ini (If using NSClient++)
Ensure the following are set.

[NRPE Handlers]
check_software_ver=cscript.exe //NoLogo //T:280 "check_software_ver.wsf" $ARG1$ $ARG2$ $ARG3$

Return Codes:
The following are returned;

Unknown: (3)
Software Package(s) not found.
$ARG3$ Allowance exceeds 3.

Critical: (2)
$ARG1$ missing or blank.
$ARG1$ is literally "$ARG1$" (You've got a Nagios/NRPE/NSClient config problem somewhere.)
Version Check with unsuccessful strict match.
Software found, but Version Allowance equals or exceeds number of components in the Version given in $ARG2$.

Warning: (1)
Version Check with unsuccessful match with Allowance

OK: (0)
Version Report Only
Version Check with successful Strict match
Version Check with successful match with Allowance

Other Execution Examples;

1. Report All Adobe Software Versions

2. Check All Flash Player Levels using strict versioning.

3. Check VMWare Workstation Level ignoring build figure

4. Check VMWare Workstation Level, using specific major version

5. Check Minimum VMWare Workstation Level, also allowing any higher major version

You should be able to work out any command needed from those.