Hello,
I'm testing a simple Powershell script, and the behaviour is rather stranger.
My script is:
$pathcounter = (Get-ChildItem -Path C:\Windows).count Write-Host $pathcounter #returning PRTG XML data "<prtg>" "<result>" "<channel>Nombre d'ojets dans C:\Windows </channel>" "<value>$pathcounter</value>" "</result>" "</prtg>"
This script return the right value in PRTG.
If I change the first line with
$pathcounter = (Get-ChildItem -Path \\MYSERVER\C$\Windows).count
the value returns 0 to PRTG, although the $pathcounter is correctly set and match the content of C:\Windows on MYSERVER.
If I execute the script in a Powershell editor the <value>xxx</value> is set correctly and match the content of the $pathcounter variable.
What is the reason the script return 0 to PRTG ?
Thanks for the answer.
Article Comments
Thank you for the answer, I have a little problem, I activated the log creation for the sensor, but the LOGS/SENSORS directory is missing on my PRTG server. I did not find the way to activate log sensor file creation in the administration tools.
Any idea ?
Jan, 2023 - Permalink
The result handling option is located in the Sensor settings. The log directory is in the PRTG data directory: https://helpdesk.paessler.com/en/support/solutions/articles/7600006351163-how-and-where-does-prtg-store-its-data
Jan, 2023 - Permalink
Hi there,
Did you already checked the exact data returned from the script? You can do this via the "Result Handling" option of the Sensor? It's possible that more errors were reported but PRTG only displays 0
Jan, 2023 - Permalink