-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get-ObjectProperty Comments raises an error - suspected due to latest PRTG update? #262
Comments
Hi @carlbeechvuw, Can you please do Set-PrtgClient -LogLevel -All
... $TmpStr=get-device -id $DeviceNode.Id | Get-ObjectProperty Comments -Verbose and then provide the verbose output from |
Hi Set-PrtgClient -LogLevel -All So I'm assuming '-All' should be 'All' Information is attached as file. |
Hi @carlbeechvuw, Sorry, my mistake - yes it should be It appears you did Are you able to provide the output from get-device -id 26645 | Get-ObjectProperty Comments -Verbose |
Hi Sorry - my mistake - here's the output... (a whole lot more manageable! :-) ) Thanks VERBOSE: Get-ObjectProperty: Synchronously executing request https://xxxx/api/getobjectstatus.htm?id=26645&name=comments&show=text&username=xxxx&passhash=xxxx
VERBOSE: Get-ObjectProperty: <?xml version="1.0" encoding="UTF-8" ?>
<prtg>
<version>21.4.72.1649+</version>
<result>xxxx
Desc: xxxx
IP: xxxx
Environment: Development
OS: Red Hat Enterprise Linux
Physical or Virtual: Virtual </result>
</prtg>
Get-ObjectProperty : ' ' is an unexpected token. The expected token is ';'. Line 5, position 10.
At line:1 char:25
+ get-device -id 26645 | Get-ObjectProperty Comments -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-ObjectProperty], XmlException
+ FullyQualifiedErrorId : System.Xml.XmlException,PrtgAPI.PowerShell.Cmdlets.GetObjectProperty |
It's possible one of the values you omitted from the output is responsible for the exception. Are you able to try and retrieve the comments of a device with a simpler set of comments on it (in particular, does not include any symbol characters) and then try and gradually add 1 line at a time from device 26645 |
More broadly, if you can provide the verbose output of a device whose comments you don't need to redact that also reproduces the issue I can take over the investigation from my end |
Hi - ok many thanks for the advice I'll give that a go over the next 24 hours... Many thanks |
Hi Many thanks for your help on this one... much appreciated! Carl. |
Regardless of what characters you have PrtgAPI should be able to parse it without issues. I am able to request a comment containing a "&" character in it Are you able to provide the full text of a comment that includes a & where you can reproduce the issue |
Hi Does this help? Cheers get-device -id 26645 | Get-ObjectProperty Comments -Verbose
VERBOSE: Get-ObjectProperty: Synchronously executing request https://xxxx/api/getobjectstatus.htm?id=26645&name=comments&show=text&username=xxxx&passhash=xxxx
VERBOSE: Get-ObjectProperty: <?xml version="1.0" encoding="UTF-8" ?>
<prtg>
<version>21.4.72.1649+</version>
<result>testing
Desc: T&D server for testing
</result>
</prtg>
Get-ObjectProperty : ' ' is an unexpected token. The expected token is ';'. Line 5, position 10.
At line:1 char:25
+ get-device -id 26645 | Get-ObjectProperty Comments -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-ObjectProperty], XmlException
+ FullyQualifiedErrorId : System.Xml.XmlException,PrtgAPI.PowerShell.Cmdlets.GetObjectProperty |
Thanks @carlbeechvuw, I was successfully able to reproduce this issue and am now investigating |
Ah - ok many thanks - much appreciated! |
Hi @carlbeechvuw, I have pushed a new pre-release version of PrtgAPI which should include a fix for this issue Are you able to try using the manual installation instructions to run the latest pre-release and advise whether the issue is now resolved? Regards, |
Hi - Yep I can confirm the update works :-) Many thanks that's brilliant! Carl. |
Describe the bug
In my program, I have the code:
.... get-device -id $DeviceNode.Id | Get-ObjectProperty Comments
This has worked up until the last PRTG update which came out just before Christmas.
Now, when executed I get the error:
Get-ObjectProperty : ' ' is an unexpected token. The expected token is ';'. Line 5, position 10.
At ....
The prtg object definately has a comment.
Steps to reproduce
As noted in the error.
What is the output of 'Get-PrtgClient -Diagnostic'?
Additional context
Error and stack trace:
$error[0]
Get-ObjectProperty : ' ' is an unexpected token. The expected token is ';'. Line 5, position 10.
At line:1 char:33
[DBG]: PS D:\MEDIA\VMAD\VMAD\PRTG_SCRIPTS>> $error[0].Exception.StackTrace
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos)
at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
at System.Xml.XmlTextReaderImpl.FinishPartialValue()
at System.Xml.XmlTextReaderImpl.get_Value()
at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r)
at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o)
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at PrtgAPI.Request.ObjectEngine.<>c__DisplayClass16_0.b__0()
at PrtgAPI.Request.ObjectEngine.ParseInvalidXml[T](Func
1 action) at PrtgAPI.Request.ObjectEngine.GetObjectsXml(IXmlParameters parameters, Action
1 responseValidator, Func2 responseParser, CancellationToken token) at PrtgAPI.PrtgClient.GetObjectPropertyRawInternal(GetObjectPropertyRawParameters parameters, String property) at PrtgAPI.PowerShell.Cmdlets.GetObjectProperty.<ProcessRecordEx>b__33_0(String p) at PrtgAPI.PowerShell.Cmdlets.GetObjectProperty.<>c__DisplayClass39_0.<WriteObjectWithProgressSafe>b__0() at PrtgAPI.PowerShell.Base.PrtgProgressCmdlet.WriteObjectWithProgress(Func
1 obj)at PrtgAPI.PowerShell.Cmdlets.GetObjectProperty.ProcessRawProperty(Func`2 getValue)
at PrtgAPI.PowerShell.Base.PrtgCmdlet.ExecuteWithCoreState(Action action)
at System.Management.Automation.CommandProcessor.ProcessRecord()
The text was updated successfully, but these errors were encountered: