New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

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

Free PRTG
Download >>

 

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


Custom EXE sensor - batch file "handle is invalid"

Votes:

0

Your Vote:

Up

Down

Background: Remote probe on Server X Sensor in question is under Server Y in a group on the remote probe on Server X. Sensor runs a batch file with the following commands:

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
SET server=%1
SET port=%2

REM Note that this assumes that the "portconnections.vbs" file exists in the listed path on the REMOTE machine.
REM Also, this script only works with host names. WinRM will not work with an IP address here. FQDN is not necessary if in the same domain.

winrs -r:%server% cscript "D:\scripts\portconnections.vbs" %port%

The batch file runs fine when I remotely login to the remote probe server X and use the same parameters I have in the sensor. I RDP into server X using the same credentials used in PRTG "Credentials for Windows Systems".

I've spent hours digging around the internet for what this error means and all I find is very specific suggestions for specific applications that don't apply here.

core-probe-connection credentials custom-exe prtg winrm

Created on Jun 8, 2015 9:53:22 PM by  Peter Bollwerk (70) 1 1

Last change on Jul 8, 2015 7:33:22 AM by  Martina Wittmann [Paessler Support]



5 Replies

Votes:

1

Your Vote:

Up

Down

Hi,

The Custom EXE Sensor of PRTG require a return value from the Batch file. The syntax is listed in the API documentation Setup > PRTG API > Custom Sensors and should look like value:message.

Furthermore, the PRTG Core Server Service is started with the local system account. Please try to change the log on account for this service to an account with elevated access rights, like an administrative account. The execution of the script might fail if PRTG is not allowed to access the script on your D: drive.

Best regards

Created on Jun 10, 2015 11:34:08 AM by  Felix Saure [Paessler Support]



Votes:

0

Your Vote:

Up

Down

The Batch file works fine when I run it while logged in using the same domain account that the Remote Probe service runs under. It outputs value:OK, such as 8:OK

Created on Jun 10, 2015 5:57:47 PM by  Peter Bollwerk (70) 1 1



Votes:

0

Your Vote:

Up

Down

Sorry, let me clarify... The probe service runs as "local system", but the we run this sensor (and others) using Security Context > Use Windows credentials of parent device and the Windows Credentials are inherited all the way from the Root settings.

Created on Jun 10, 2015 6:14:10 PM by  Peter Bollwerk (70) 1 1



Votes:

0

Your Vote:

Up

Down

Hi, For some customer it helped to additionally change the log on account of the service as well. Please try to change this account and see if the script works.

Additionally, please try if the demo batch files of PRTG are working. This issue could also be related to the Remote-Commandline. At the moment you do not pass the username / password, do you need to enter credentials if you execute the script manually?

You could also ease this process by installing a Remote Probe on the target device and executing the VBS directly.

Created on Jun 11, 2015 8:09:24 AM by  Felix Saure [Paessler Support]

Last change on Jun 11, 2015 8:15:25 AM by  Felix Saure [Paessler Support]



Votes:

0

Your Vote:

Up

Down

I tried setting the logon account for the service to the domain service account, but it cause most of the existing sensors to error out, so that's not an option at the moment. Besides, what's the point of using the inherited credentials option then?

The demo batch and VBS files all work fine.

I do not get prompted for credentials when I run my batch file. It works just fine while I'm logged into the probe server with the credentials that PRTG is set to use for Windows machines.

We don't want to get into a situation where we need to have a remote probe on every server we want this data from. That just isn't feasible or scalable for an Enterprise company.

It would be nice if there was some logging output that would explain what the exact problem is. But without knowing exactly how PRTG executes a batch file from a sensor, I don't have much to go on.

Created on Jun 11, 2015 9:50:29 PM by  Peter Bollwerk (70) 1 1



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.