Jannos-443 / PRTG-M365

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

not a realy issue but understanding problem #5

Closed dle272 closed 1 year ago

dle272 commented 1 year ago

Maybe it's my fault but I understood the sensor is showing the actual license usage. Like e.g. 20 users out of 30 are activly using e.g. Project. I know the graph API can handle this request. As I see the sensor is showing all licenses. Like in the mentiond example 30 Project Licences.

Did I missconfigured something? If not; would it be possible to implement this in an upcoming version? Thanks a lot and have a happy new year!

Jannos-443 commented 1 year ago

Hi, the Sensor shows bought, assigned and free licenses. For example you bought 20 licenses, assigned 15 licenses and there are only 5 licenses free.

You are talking about the real usage from the 15 assigned licenses?

dle272 commented 1 year ago

Yes! I was talking about the real usage. E.g. 15 licenses are assigned but only 5 users are using the software every two days. But the others users didn't use it for 2 months now.

Jannos-443 commented 1 year ago

sorry but this is not the goal at the moment. Could you show me the Graph API Call for this request?

dle272 commented 1 year ago

Don't worry I just missunderstood the description. The API ist documented here: https://learn.microsoft.com/en-us/graph/api/resources/microsoft-365-apps-usage-report?view=graph-rest-1.0&preserve-view=true

Thank you!

hhantelm commented 1 year ago

Hi. I am finding that the -FriendlyName results in not creating channels for several SKUs that exist (i.e Project Plan 3 for Faculty). I can find the name in the download file from its associated GUID, so I think there is a bug in the script. If I run it outside PRTG, the result is the same, several that have no friendly name returned. I will continue to investigate and let you know if I find the issue, just thought 2 heads are better than one :)

hhantelm commented 1 year ago

I think I might be on to something. The download file has a space at the end of several GUIDs resulting in no match on line 262 of your script, so no friendly name returned. I think it needs to handle cutting off the white space somehow.

hhantelm commented 1 year ago

$NewLic.FriendlyName = $LicCSV | Where-Object { ($_.GUID.Trim()) -eq $R.skuId } | Select-Object -First 1 -ExpandProperty Product_Display_Name

This fixed my issue of the whitespace in the download file. Unfortunately, three of our GUIDs do not exist in the download file. Next steps would be to modify the foreach loop for $FriendlyName to check for $null and spit out skuPartNumber instead if one does not exist.

Jannos-443 commented 1 year ago

thank you for the fix with the whitespaces. Please try the new version, I also added the check if the FriendlyName is $null