Retrieving File Version Number? (Powershell)

Votes:

0

Your Vote:

Up

Down

I have made a custom sensor that uses a Powershell script to show the file version of an executable, the script is below:

(Get-Command "C:\XXX\XXX\XXX\XXX.exe").FileVersionInfo.Fileversion

Using this, the version does display correctly in the monitor. However, it displays in an error state. How do I make it so that it no longer is an error, but still displays the file version of an executable?

Much appreciated in advanced.

exe-script powershell prtg

Created on Feb 29, 2012 5:47:15 AM by  BradHorton (0) 1



1 Reply

Votes:

0

Your Vote:

Up

Down

Hi,
please note that PRTG expects a specific format for return values:

value:message

In your case the script has to look something like this:

@echo off

$return_fileversion = (Get-Command "C:\XXX\XXX\XXX\XXX.exe").FileVersionInfo.Fileversion
echo $return_fileversion + ":OK"

For further documentation please go, in your PRTG installation, "Setup" -> "PRTG API". Best Regards

Created on Feb 29, 2012 10:13:31 AM by  Konstantin Wolff [Paessler Support] (3,860) 3 2



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.

PRTG
Network Monitor
Intuitive to Use.
Easy to manage.

150.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Visit
www.paessler.com

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

Top Tags


View all Tags