Hi Guys,
i´ve got an problem regarding an Custom Sensor in Prtg.
I use the following Powershell-Script to get information from an webpage and to trim it to a short output.
the script:
$webpage=Invoke-WebRequest "private ip-address" $webpage.RawContent | Out-File "C:\Skripte\Tank_S3\webpage_Fuellstand.txt" ASCII -Width 9999 $input_path = "C:\Skripte\Tank_S3\webpage_Fuellstand.txt" $output_file2 = "C:\Skripte\Tank_S3\Fuellstand.txt" $regex = '([0-9]{1,2}%)' $string_fuellstand = Select-String -Path $input_path -Pattern $regex -list | % { $_.Matches } | % { $_.Value } $string_fuellstand = $string_fuellstand.Remove(2) $text = $string_fuellstand + ":Wert ermittelt." $string_fuellstand = $string_fuellstand + ";" + $(get-date).toString('yyyy-MM-dd;HHmmss') $string_fuellstand >> $output_file2 write-host $text
It works fine as long as an User is logged into the PRTG-Computer.
This is the output while someone is logged in:
80;2017-04-12;103427
If no one is logged in, following output is generated:
;2017-04-12;103915
I´ve already tried to give specific access rights to the sensor. The security is set to use the access data of the parenting device.
I´m now a little bit confused because the script alone works if set in the task scheduler without anyone logged in.
Am I missing some point?
Kind regards,
Daniel
Add comment