What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

How to inherit windows credentials from parent device in a batch script?

Votes:

0

I wrote a batch script, and chose the option in security context: Use windows credentials of parent device. It gives an error: Access denied. Please check your Windows credentials. (code: PE095)

How can I include the credentials in the batch script?

batch batch-file custom-sensor prtg wmi

Created on Aug 15, 2019 9:50:44 AM



9 Replies

Votes:

0

Hi there,

The security context means that the script is started with these credentials. If there are additional credentials needed within the script, you can use parameters to provide the information.

Please also take a look at this manual. It shows placeholder that can be used as parameters in the Command-line Parameters section.


Kind regards,
Birk Guttmann, Tech Support Team

Created on Aug 15, 2019 3:25:11 PM by  Birk Guttmann [Paessler Support]



Votes:

0

Hi,

I tried using the script without any parameters and it is giving me Access denied error.

Note that in the script I'm trying to access a shared file in the domain. Then I tried this line: %host -UserName %windowsdomain\%windowsuser -Password "%windowspassword" and it still gives me the Access denied error.

Created on Aug 16, 2019 8:16:29 AM



Votes:

0

Hi,

You can take a look at the detailed results by enabling "Write result to disk" in the sensor's "Settings" tab. With the next scan it will write one or several result-files into "C:\ProgramData\Paessler\PRTG Network Monitor\Logs (Sensors)" of your PRTG server (or on the Remote Probe if applicable). All files have the sensor's numeric ID in their filenames. The sensor ID can be found on the sensor's "Overview" tab.

Please note that handling access rights and parameters in a batch script can be very tricky. I would recommend to use the Powershell.


Kind regards,
Birk Guttmann, Tech Support Team

Created on Aug 16, 2019 8:33:36 AM by  Birk Guttmann [Paessler Support]



Votes:

0

Hi,

I need more help with this issue please. Can you help me understand how prtg exe scripts are run with the inherited credentials? Where does the script run?

I am trying to access a file and compare text within it. The file is located in a network drive.

Thank you!

Created on Aug 16, 2019 11:23:53 AM



Votes:

0

Hi there,

The script will run on the (Remote) Probe Server to which device is added. You can also find the manuals for the corresponding custom sensors under the following link.


Kind regards,
Birk Guttmann, Tech Support Team

Created on Aug 16, 2019 1:30:28 PM by  Birk Guttmann [Paessler Support]



Votes:

0

Thank you, but that is quite generic and doesn't answer the primary question.

I still don't understand how the parameters are passed to the batch script, especially the parent device credentials.

Do I need to create a connection to the network drive in the script? How should it connect with the network drive with credentials inherited by the parent device?

Sorry for the long questions, I have gone through a lot of links and can't seem to make it work.

Created on Aug 16, 2019 1:44:44 PM



Votes:

0

Hi there,

Please note, that PRTG can only run scripts on the corresponding Probe servers. If you need to run commands on an external server, you need to use something like invoke-command in Powershell.

Please take a look at this link for some more information about remote Powershell scripting.


Kind regards,
Birk Guttmann, Tech Support Team

Created on Aug 19, 2019 2:42:01 PM by  Birk Guttmann [Paessler Support]



Votes:

0

Hello. I have exactly the same issue. This is the log produced by my custom sensor:

Data['linuxloginpassword'].asString := ''; Data['tlsexplicit_pop3'].asString := ''; Data['fastcount'].asString := '0'; Data['valuetype'].asString := '0'; Data['notonpod'].asString := '0'; Data['resultfile'].asString := 'Result of Sensor 2425.txt'; Data['windowsloginusername'].asString := 'a.miccoli'; Data['hostv6'].asString := ''; Data['exefile'].asString := 'WMI_OMC.bat'; Data['lastuptime'].asString := '0'; Data['writeresult'].asString := '2'; Data['blockedsens'].asString := ''; Data['reqmsginterval'].asString := '60'; Data['windowslogindomain'].asString := 'SIBLQ15GC6'; Data['lastmsg'].asString := '#O95'; Data['tlsexplicit_default'].asString := ''; Data['tlsexplicit_imap'].asString := ''; Data['channelnames'].asString := 'Execution Time'#$D#$A + '1'#$D#$A + ''; Data['canlinux'].asString := '1'; Data['isexesensor'].asString := '1'; Data['windowsloginpassword'].asString := '***'; Data['environment'].asString := ''; Data['mutexname'].asString := ''; Data['channelinfos'].asString := '{"1":{"Unit":"oukTimeResponse","CustomUnit":"","ValueLookupName":"","LimitMode":"0","LimitMinError":"","LimitMinWarning":"","LimitMaxError":"","LimitMaxWarning":""}}'; Data['channel'].asString := 'Value'; Data['uptimecount'].asString := '0'; Data['reboot'].asString := '44377.6114779051'; Data['usednstime'].asString := '0'; Data['newpowershell'].asString := '1'; Data['vmwareparams'].asString := '1'; Data['linuxlogindomain'].asString := ''; Data['tlsexplicit_port'].asString := ''; Data['monitorchange'].asString := '0'; Data['inerror'].asString := '1'; Data['sensorid'].asString := '2425'; Data['ipversion'].asString := '0'; Data['tlsexplicit_smtp'].asString := ''; Data['host'].asString := '10.112.11.10'; Data['usewindowsauthentication'].asString := '1'; Data['unit'].asString := '#'; Data['simulate'].asString := '0'; Data['tlsexplicit_ftp'].asString := ''; Data['timeout'].asString := '60'; Data['momopersistent'].asString := ''; Data['exeparams'].asString := '';

Can you help me, please?

Created on Jul 1, 2021 3:56:10 PM



Votes:

0

Hello there,

In those cases it is usually better to create an official support ticket. Of course you can still discuss this with other users in our Knowledge Base.


Kind regards,
Birk Guttmann, Tech Support Team

Created on Jul 2, 2021 11:35:33 AM by  Birk Guttmann [Paessler Support]




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.