Jannos-443 / PRTG-M365

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

Cannot index into a null array #2

Closed ymcnelly closed 1 year ago

ymcnelly commented 1 year ago

I cant get the sensor to work. I keep getting: line:212 char:9 --- message: Cannot index into a null array. --- line: $ErrorText = ($Errors.licenseAssignmentStates | Where-Object { $_.assignedByGroup -eq $group.id })[0].error

as far as my very limited powershell knowledge goes if ($LicenceErrorCount -gt 0) should help, but it still cant get the sensor to work. Can somebody tell me what i am doing wrong?

Jannos-443 commented 1 year ago

Hey ymcnelly,

I hope I fixed it, please try using the latest license Script.

best regards

ymcnelly commented 1 year ago

Hi Janos,

Thank you for the quick reply. Your fix worked like a charm. There is one thing missing i had to add to make it work: $ErrorByGroup = ($Errors.licenseAssignmentStates | Where-Object { $_.assignedByGroup -eq $group.id}) The last ) was missing from the script. It's on line 196

Thank again for this great script. I couldn't the the basic sensors to display the licenses at all so this is a real saviour for me.

Jannos-443 commented 1 year ago

I fixed the missing bracket and no problem, I am happy to help :)