Im trying to run a SQL script from within a powershell script sensor.
But i need to feed the SQL credentials from PRTG into the EXEML Powershell script.... is this possible?
Basically,.. is there any way to access the PRTG credential store from within a powershell script?
Why would i do this?
Because i'd like to return different results in different cases, write some stuff to logging etc, which i cant do with plain TSQL.
Article Comments
Hello trung,
Thank you very much for your KB-post.
Actually it is not possible to use the SQL credentials which are set in the device-settings of PRTG.
The only suitable way to enter the credentials in PRTG (for the usage in an external script) is by using the Parameters field in the sensor settings.
Kindly be aware to use the right syntax for these parameter. Please see a short example:
-host "server1" -user "admin" -password "MyLittleSecret" -param "abc123"
For details, please refer to the manual page of the EXE/Script Sensor.
Best regards,
Sven
Jan, 2017 - Permalink
ok great many thanks Sven!
Jan, 2017 - Permalink
Hello trung,
Thank you very much for your KB-post.
Actually it is not possible to use the SQL credentials which are set in the device-settings of PRTG.
The only suitable way to enter the credentials in PRTG (for the usage in an external script) is by using the Parameters field in the sensor settings.
Kindly be aware to use the right syntax for these parameter. Please see a short example:
-host "server1" -user "admin" -password "MyLittleSecret" -param "abc123"
For details, please refer to the manual page of the EXE/Script Sensor.Best regards,
Sven
Jan, 2017 - Permalink