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.
Add comment