Hello,
this static ps script works as expected: {{{ $XMLResult = @" <prtg><result><channel>Server 1</channel><value>0</value></result><result><channel>Server 2</channel><value>1</value></result><result><channel>Server 3</channel><value>2</value></result></prtg> "@
Write-Host $XMLResult }}}
but I want to build the above result during runtime in a variable like this: {{{ $XMLResult = @" $myString "@
Write-Host $XMLResult }}}
or like this: {{{ $XMLResult = @" $($myString) "@
Write-Host $XMLResult }}}
The sensor shows Code: PE233 and Code: PE231error message when using a variable although the scripts have the exactly output when running from command line.
Can someone please provide an example for building channels dynamically during runtime?
Thank you in advance
Hello,
The script in this article would be a good example. You can also visit our Sensor Hub for more examples.
Kind regards,
Sasa Ignjatovic, Tech Support Team
Dec, 2022 - Permalink