Jannos-443 / PRTG-M365

PRTG Microsoft 365 Scripts
MIT License
10 stars 6 forks source link

M365 - XML Structural error #13

Open BartoPhotographer opened 2 weeks ago

BartoPhotographer commented 2 weeks ago

Hi, thx for your work! I get the following error with the M365 sensor:

XML: Structural error in xml file, 2 open items. -- JSON: The returned JSON does not match the expected structure (Invalid JSON.). (code: PE231)

Any idea?

Jannos-443 commented 2 weeks ago

Hey, did you check the powershell x86 and x64 execution policy?

If policy is right I would try to execute it directly in Powershell.

BartoPhotographer commented 1 week ago

Hi, I´ve checked the execution policy. Should be okay. When I execute it directly in Powershell I get:

Remove-Variable : Cannot find a variable with the name 'ProxyCreds'. At C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\PRTG-M365-AppSecrets.ps1:90 char:5

Token not found, going to renew Token sucessfully got new MS Graph Token

Next Cert Expiration -2243 Custom Days 1 30 10 less than 90 days left 175 Count less than 180 days left 196 Count Next to expire: App "az-login" Secret "" expires in -2243d; App "az-login" Secret "" expires in -2240d; App "az-login" Secret "" expires in -2240d; App "myAKSCluster" Secret "m y A K S C l u s t e " expires in -1968d; App "CloudManage" Secret "D e v e l o p m e n t " expires in -1964d;

On 20. Jun 2024, at 19:58, Jannos-443 @.***> wrote:

Hey, did you check the powershell x86 and x64 execution policy?

If policy is right I would try to execute it directly in Powershell.

— Reply to this email directly, view it on GitHub https://github.com/Jannos-443/PRTG-M365/issues/13#issuecomment-2181240842, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT6CKPPHLVDHQOT5RXGCBX3ZIMJ5ZAVCNFSM6AAAAABJUG37ZCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBRGI2DAOBUGI. You are receiving this because you authored the thread.

BartoPhotographer commented 1 week ago

If I comment out the text section, I no longer get an error.

Jannos-443 commented 5 days ago

thats interessting, could you send me the LOG from the PRTG Sensor itself after getting this error? Maybe we can see the issue in the log.

Store result: Store the last sensor result in the \Logs\sensors subfolder of the PRTG data directory on the probe system. The file names are Result of Sensor [ID].txt and Result of Sensor [ID].Data.txt. This setting is for debugging purposes. PRTG overwrites these files with each scanning interval.

you could also try to add a -ErrorAction SilentlyContinue in line 73 but I guess this will not help. Remove-Variable ProxyAddress -ErrorAction SilentlyContinue