Getting MailboxSettings, DeviceEnrollmentLimit properties with Get-MgUser throws an error

Getting MailboxSettings, DeviceEnrollmentLimit properties with Get-MgUser throws an error
0

Upvotes

Upvote

 Oct 22 2021
0 Comments 
New

Error:

Get-MgUser : No OData route exists that match template ~/entityset/key with http verb GET for request /StatelessOnboardingService/users('<UserPrincipalName>').

 

NunoAlexandre_0-1634924544379.png

 

Transcript:

 

PS C:\WINDOWS\system32> Get-MgUser -UserId Test#########@###########.net -Select DeviceEnrollmentLimit
Get-MgUser : No OData route exists that match template ~/entityset/key with http verb GET for request /StatelessOnboardingService/users('Test#########@###########.net').
At line:1 char:1
+ Get-MgUser -UserId Test#########@###########.net -Select DeviceEnroll ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: ({ UserId = Test...ndProperty =  }:<>f__AnonymousType44`4) [Get-MgUser_Get1], RestException`1
    + FullyQualifiedErrorId : No method match route template,Microsoft.Graph.PowerShell.Cmdlets.GetMgUser_Get1
PS C:\WINDOWS\system32> Get-MgUser -UserId Test#########@###########.net -Select MailboxSettings
Get-MgUser : The mailbox is either inactive, soft-deleted, or is hosted on-premise.
At line:1 char:1
+ Get-MgUser -UserId Test#########@###########.net -Select MailboxSetti ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: ({ UserId = Test...ndProperty =  }:<>f__AnonymousType44`4) [Get-MgUser_Get1], RestException`1
    + FullyQualifiedErrorId : MailboxNotEnabledForRESTAPI,Microsoft.Graph.PowerShell.Cmdlets.GetMgUser_Get1
PS C:\WINDOWS\system32>