I am trying to setup a batch file (Test10.bat) to execute when one of our sensors goes down. I created a new notification and have the following setup

program file: Test10.bat
Parameter: (blank)
Domain or Computer Name: Remote Computer Name
Username: Admin username on remote computer
Password: Admin password
Timeout: 30 

I created two batch files one that executes from the server where PRTG is installed, and one that works locally on the remote computer. Both work out of PRTG, but not when PRTG tries to execute. I also changed the PRTG CORE SERVER SERVICE from local system account to a domain admin account. Is there something missing?


Article Comments

Hello,

Thank you very much for the KB-Post. Can you please share more details, like the batch files and also the full settings for those exe/script-notifications in PRTG; so that we have the full setup?
Also, when testing this notification from PRTG, which error does PRTG state under Logs->System Events->Notifications?

best regards.


Apr, 2017 - Permalink

The error message we receive is "Error sending "EXE": Timeout (Sensor/Source/ID: 3111/3111/3)". The batch file should execute to start up a remote registry service on the remote computer. It works out of PRTG but not within.


Apr, 2017 - Permalink

Please see if the tips from the following answer do help: EXE Notifications: Aspects to Consider


Apr, 2017 - Permalink

That seem's to got me closer to the goal. I now see "Error sending "EXE": A required privilege is not held by the client. (0x522)" in the logs. I tried researching a resolution but couldn't seem to correct the issue. Any ideas?


Apr, 2017 - Permalink

Those tips did help, but now I'm getting a different error message. I am now seeing "a required privilege is not held by client" in the logs. I tried to search for a fix but I couldn't find one. Any suggestions?


Apr, 2017 - Permalink

Can you share the full content of the batch files here?


May, 2017 - Permalink

The batch file on the server does this:

"psexec
user-PC "C:\users\user\prtgtesting\test10.bat" Pause"

The test10.bat does this: "start "" /b "C:\Users\user\Desktop\test.lnk" Pause"

test.lnk is a shortcut that will always run as administrator. The shortcut runs the test.bat and it has the following: "sc start remoteregistry Pause"

Hope this is what you were asking for.


May, 2017 - Permalink

It may still be a permissions issue here, even though the Core Service is running under an admin account. Can you check, if it is possible to write the output of the psexec-call into a file? To see if it fails there. So that you can try filling the call also with admin-credentials for a test.


May, 2017 - Permalink

I'm not entirely sure what you mean? Do you want me to not put an account to it requests it?


May, 2017 - Permalink

I apologise for the confusion. I suspect that currently the account used, doesn't have sufficient permissions for the call, and that getting the script to write debug output into a file (most importantly the response / exit code from the psexec call) may help to show why it fails exactly.


May, 2017 - Permalink

I am using the same credentials on the client computer and in PRTG. I am also able to execute the ".bat" file without PRTG and it works with no issues. How do I get the batch files to create a exit code for review?


May, 2017 - Permalink

Please be aware that we only provide technical support for PRTG (i.e. 'stuff does not work' or 'how does this stuff work') itself. There is only limited support for customising of PRTG. This includes custom sensors, as well as custom notifications, customising on PRTG's Webserver files, and also custom map objects.
There obviously is a difference when PRTG executes the script vs. when you execute it. Bear in mind, PRTG runs as a service, and not in a "desktop session" that you may have used when testing the script.
The error message indicates it's a permissions issue. You need to research if the psexec-call has an error response / output, and if you can divert this into a file with simple things like:

>> c:\debug.txt

May, 2017 - Permalink