petripaavola / IntuneDeviceDetailsGUI

Intune Device Details GUI
MIT License
317 stars 35 forks source link

Errors when last-login is longer than 30 days #12

Open NekoJonez opened 6 months ago

NekoJonez commented 6 months ago
Invoke-MSGraphGetRequestWithMSGraphAllPages : There was error with MGGraphRequest with url https://graph.microsoft.com/beta/users/acc7dc
27-f933-49ec-b598-138de6fb3db5?$select=*!
At C:\Users\----\Powershell\IntuneDeviceDetailsGUI-main-2.98\IntuneDeviceDetailsGUI.ps1:1769 char:36
+ ... atestCheckedinUser = Invoke-MSGraphGetRequestWithMSGraphAllPages $url
+                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-MSGraphGetRequestWithMSGraphAllPages

Invoke-MSGraphGetRequestWithMSGraphAllPages : There was error with MGGraphRequest with url https://graph.microsoft.com/beta/users//membe
rOf?_=1577625591876!
At C:\Users\---\Powershell\IntuneDeviceDetailsGUI-main-2.98\IntuneDeviceDetailsGUI.ps1:1814 char:49
+ ... UserGroupsMemberOf = Invoke-MSGraphGetRequestWithMSGraphAllPages $url
+                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-MSGraphGetRequestWithMSGraphAllPages

I'd change this a bit so if the last logged in user is longer than 30 days ago, it doesn't show this error but rather shows another message informing the user that the data is not able to be retrieved.

petripaavola commented 6 months ago

Yes, this is because I changed script to use MgGraph module and I had to creat the Graph API fetch function again.

It should handle Graph API error messages better and print something more better looking to console. It does handle the error but console printing is not optimal. Also it should print the exact Graph API error message at least to Write-Verbose for better troubleshooting.

I'll look into this in next versions.