What is the value you are especting to receive?
For example, if the value you are expecting is a "string", then the issue in this code is that the value of the $SizeArchivo variable is not being properly formatted as a string, which can cause it to display as 0 in the output.
To fix this, you can explicitly convert the value to a string using the ToString() method, like so:
# get file size
$SizeArchivo = (Get-Item $ServerArchivo).Length
#send data to PRTG
"<prtg>"
"<result>"
"<channel>Free size disc</channel>"
"<unit>BytesDisk</unit>"
"<value>" + $SizeArchivo.ToString() + "</value>"
"</result>"
"</prtg>"
By using the ToString() method, the value of $SizeArchivo will be properly converted to a string that can be displayed correctly in the PRTG output.
Add comment