New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

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

 

Top Tags


View all Tags


how to setup a custom sensor i keep getting errors. like invalid JSON.

Votes:

0

Your Vote:

Up

Down

Kind PRTG users,

i am trying to build a script to show me the enabled users in a active directory. i use the following command: (get-aduser -filter *|where {$_.enabled -eq "True"}).count this wil give me a value like 178. But when i put the script underneath together it wont work. I get a The returned json does not match the expected structure (Invalid JSON.). (code: PE231) error. I also get this with another script about windows backup. What is wrong with my script?

$value = (get-aduser -filter *|where {$_.enabled -eq "True"}).count
<prtg>
  <result>”
    <channel>usersenabled</channel>”
    <value>$value</value>”
    <LimitMaxError>200</LimitMaxError>”
    <LimitMode>180</LimitMode>”
  </result>”>
</prtg>

when i look at the log it gives me the following:


The term 'get-aduser' is not recognized as the name of a cmdlet, function, scri
pt file, or operable program. Check the spelling of the name, or if a path was 
included, verify that the path is correct and try again.
At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\activeuser
sAD.ps1:1 char:21
+ $value = (get-aduser <<<<  -filter *|where {$_.enabled -eq "True"}).count
    + CategoryInfo          : ObjectNotFound: (get-aduser:String) [], CommandN 
   otFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
The term '<' is not recognized as the name of a cmdlet, function, script file, 
or operable program. Check the spelling of the name, or if a path was included,
 verify that the path is correct and try again.
At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\activeuser
sAD.ps1:2 char:2
+ < <<<< prtg>
    + CategoryInfo          : ObjectNotFound: (<:String) [], CommandNotFoundEx 
   ception
    + FullyQualifiedErrorId : CommandNotFoundException
 
The term '<' is not recognized as the name of a cmdlet, function, script file, 
or operable program. Check the spelling of the name, or if a path was included,
 verify that the path is correct and try again.
At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\activeuser
sAD.ps1:3 char:4
+   < <<<< result>
    + CategoryInfo          : ObjectNotFound: (<:String) [], CommandNotFoundEx 
   ception
    + FullyQualifiedErrorId : CommandNotFoundException
 
The term '<' is not recognized as the name of a cmdlet, function, script file, 
or operable program. Check the spelling of the name, or if a path was included,
 verify that the path is correct and try again.
At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\activeuser
sAD.ps1:4 char:6
+     < <<<< channel>usersenabled</channel>
    + CategoryInfo          : ObjectNotFound: (<:String) [], CommandNotFoundEx 
   ception
    + FullyQualifiedErrorId : CommandNotFoundException
 
The term '<' is not recognized as the name of a cmdlet, function, script file, 
or operable program. Check the spelling of the name, or if a path was included,
 verify that the path is correct and try again.
At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\activeuser
sAD.ps1:5 char:6
+     < <<<< value>$value</value>
    + CategoryInfo          : ObjectNotFound: (<:String) [], CommandNotFoundEx 
   ception
    + FullyQualifiedErrorId : CommandNotFoundException
 
The term '<' is not recognized as the name of a cmdlet, function, script file, 
or operable program. Check the spelling of the name, or if a path was included,
 verify that the path is correct and try again.
At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\activeuser
sAD.ps1:6 char:6
+     < <<<< LimitMaxError>200</LimitMaxError>
    + CategoryInfo          : ObjectNotFound: (<:String) [], CommandNotFoundEx 
   ception
    + FullyQualifiedErrorId : CommandNotFoundException
 
The term '<' is not recognized as the name of a cmdlet, function, script file, 
or operable program. Check the spelling of the name, or if a path was included,
 verify that the path is correct and try again.
At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\activeuser
sAD.ps1:7 char:6
+     < <<<< LimitMode>180</LimitMode>
    + CategoryInfo          : ObjectNotFound: (<:String) [], CommandNotFoundEx 
   ception
    + FullyQualifiedErrorId : CommandNotFoundException
 
The term '<' is not recognized as the name of a cmdlet, function, script file, 
or operable program. Check the spelling of the name, or if a path was included,
 verify that the path is correct and try again.
At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\activeuser
sAD.ps1:8 char:4
+   < <<<< /result>
    + CategoryInfo          : ObjectNotFound: (<:String) [], CommandNotFoundEx 
   ception
    + FullyQualifiedErrorId : CommandNotFoundException
 
The term '<' is not recognized as the name of a cmdlet, function, script file, 
or operable program. Check the spelling of the name, or if a path was included,
 verify that the path is correct and try again.
At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\activeuser
sAD.ps1:9 char:2
+ < <<<< /prtg>
    + CategoryInfo          : ObjectNotFound: (<:String) [], CommandNotFoundEx 
   ception
    + FullyQualifiedErrorId : CommandNotFoundException
 

could this be possible because i run it from a server without any active directory?

custom-script-exe json powershell prtg script wmi-custom-sensor xml

Created on Mar 4, 2016 10:26:35 AM by  Dennieboy96 (0) 1

Last change on Mar 4, 2016 12:23:08 PM by  Torsten Lindner [Paessler Support]



1 Reply

Votes:

0

Your Vote:

Up

Down

Hi Dennie,

Is the get-aduser module listed if you call the get-module command? if not, you can import the module via import-module. Try to execute the script on the machine running the probe to open up a similar session and see if it works afterwards.

It might also be required to install the Active Directory management tools.

Best regards, Felix

Created on Mar 7, 2016 1:09:09 PM by  Felix Saure [Paessler Support]

Last change on Mar 7, 2016 1:15:28 PM by  Felix Saure [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.