What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Problem with EXE/Script Advanced Sensor

Votes:

0

Your Vote:

Up

Down

I have a script that is used with the EXE/Script Advanced Sensor. If I let it run manually, it gives me a correct looking XML answer.

<prtg>
  <result>
    <channel>PasswordSyncStatus</channel>
    <value>1</value>
  </result>
  <result>
    <channel>LastDirSync</channel>
    <value>16.8841946583333</value>
    <float>1</float>
  </result>
  <result>
    <channel>LastPWSync</channel>
    <value>23.9675279916667</value>
    <float>1</float>
  </result>
  <result>
    <channel>SyncedUser</channel>
    <value>121</value>
  </result>
</prtg>

But PRTG keeps saying, that it is malformated.

Error: XML: The returned XML does not match the expected schema. (code: PE233) -- JSON: The returned JSON does not match the expected structure (Invalid JSON.). (code: PE231)

I have no idea, what's wrong with it.

exe pe233 xml

Created on Nov 30, 2021 2:30:11 PM by  joerg_burri (0) 1

Last change on Dec 1, 2021 7:14:02 AM by  Felix Wiesneth [Paessler Support]



3 Replies

Votes:

0

Your Vote:

Up

Down

Hi Joerg,

From first look your output seems to be fine. Did you use write-host to get this result? Please try to use write-output since we did some security changes and therefore write-host won't work anymore.


Kind regards

Felix Wiesneth - Team Tech Support

Created on Dec 1, 2021 7:16:38 AM by  Felix Wiesneth [Paessler Support]



Votes:

0

Your Vote:

Up

Down

I tried with both, but it didn't help.

This is how teh output is created.

# Results for PRTG Sensor with Channels
$XML = "<prtg>"
$XML += "<result><channel>PasswordSyncStatus</channel><value>$PasswordSync</value></result>"
$XML += "<result><channel>LastDirSync</channel><value>$DirSync</value><float>1</float></result>"
$XML += "<result><channel>LastPWSync</channel><value>$PWSync</value><float>1</float></result>"
$XML += "<result><channel>SyncedUser</channel><value>$SyncedUser</value></result>"
$XML += "<result><channel>SyncedGroup</channel><value>$SyncedGroups</value></result>"
$XML += "<result><channel>ServicePrincipalPasswordTimer</channel><value>$SP_PRTG_Monitoring_Days_left</value></result>"
$XML += "</prtg>"

#Just to make it clean XML code
Function WriteXmlToScreen ([xml]$xml) 
{
    $StringWriter = New-Object System.IO.StringWriter;
    $XmlWriter = New-Object System.Xml.XmlTextWriter $StringWriter;
    $XmlWriter.Formatting = "indented";
    $xml.WriteTo($XmlWriter);
    $XmlWriter.Flush();
    $StringWriter.Flush();
    Write-Output $StringWriter.ToString();
}
#WriteXmlToScreen "$XML"
write-output "$XML"

Created on Dec 1, 2021 12:31:18 PM by  joerg_burri (0) 1

Last change on Dec 1, 2021 1:10:42 PM by  Felix Wiesneth [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi Joerg,

I tried to recreate the output with your script and with write-output I got no XML formatted output. You will need to change $XML so that there is a XML formatted output.


Kind regards

Felix Wiesneth - Team Tech Support

Created on Dec 1, 2021 1:46:43 PM by  Felix Wiesneth [Paessler Support]



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.