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?


Article Comments

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


Aug, 2019 - Permalink

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.


Aug, 2019 - Permalink

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


Aug, 2019 - Permalink

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!


Aug, 2019 - Permalink

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


Aug, 2019 - Permalink

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.


Aug, 2019 - Permalink

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


Aug, 2019 - Permalink

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?


Jul, 2021 - Permalink

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


Jul, 2021 - Permalink