Powershell Get-ExoMailbox User not found

Florent GUILLOT 1 Reputation point
2023-01-05T17:05:50.437+00:00

Bonjour,

En powershell:
quand j'ai un compte utilisateur créé le jour, j'ai erreur suivant avec la commande Get-EXOMailbox -Identity ******@xxxxxxxx.com

PS C:\Users\xxxxx> Get-EXOMailbox -UserPrincipalName "@xxxxxxxx.com"
Get-EXOMailbox : Error while querying REST service. HttpStatusCode=404 ErrorMessage={"error":{"code":"NotFound","message":"Error executing request. The operation couldn't be performed because object '
@xxxxxxxx.com' couldn't be found on
'AM6PR10A01DC005.EURPR10A001.PROD.OUTLOOK.COM'.","details":[{"code":"Context","target":"","message":"Ex6F9304|Microsoft.Exchange.Configuration.Tasks.ManagementObjectNotFoundException|The operation couldn't be performed because object
'@xxxxxxxx.com' couldn't be found on 'AM6PR10A01DC005.EURPR10A001.PROD.OUTLOOK.COM'."}],"innererror":{"message":"Error executing request. The operation couldn't be performed because object '@xxxxxxxx.com' couldn't be found on
'AM6PR10A01DC005.EURPR10A001.PROD.OUTLOOK.COM'.","type":"Microsoft.Exchange.Admin.OData.Core.ODataServiceException"}}}}
Au caractère Ligne:1 : 1

  • Get-EXOMailbox -UserPrincipalName "******@xxxxxxxx.com"
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : Erreur de protocole : (:) [Get-EXOMailbox], RestClientException
  • FullyQualifiedErrorId : An error occurred while processing this request.,Microsoft.Exchange.Management.RestApiClient.GetExoMailbox

Alors que si je lance a commande avec mon nom utilisateur j'ai pas erreur.

c'est comme ci il y a un délai, pourtant j'ai relancé à la commande 1heure apres que le compte soit créé

une idée ?

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
42,047 questions
{count} votes

5 answers

Sort by: Most helpful
  1. Rich Matheisen 47,596 Reputation points
    2023-01-05T19:11:12.95+00:00

    The Get-EXOMailbox looks for a mailbox. Did you create a mailbox for this user? Perhaps you should try Get-MsolUser to verify the account exists before looking for the mailbox.

    0 comments No comments

  2. Nicolas Roche 411 Reputation points
    2023-01-06T05:58:38.61+00:00

    Hello,

    Did you create a mailbox for this user ?
    Did you find him in the Exchange Online ECP ?

    Best Regards

    0 comments No comments

  3. Florent GUILLOT 1 Reputation point
    2023-01-06T10:19:17.763+00:00

    merci, j'ai modifier mon script et cette partie c'est ok :)

    Par contre j'ai cette partie la ou je bloque pour les group utilisateurs

    > PS C:\Users\administrateur.xxxxx> Get-MgUserTransitiveMemberOf -UserId $emailcopyoffice365 | ? {$_.AdditionalProperties['mailEnabled'] -eq 'True'} | ForEach-Object { Add-UnifiedGroupLinks -Identity "b147a1be-99ae-4240-86b0-6b03b9f3124f" -links yyyy@xxxxxxxxxxxxx .com -LinkType "Members" } > > Write-ErrorMessage : Ex6F9304|Microsoft.Exchange.Configuration.Tasks.ManagementObjectNotFoundException|Impossible d'effectuer l'opération, car l'objet 'b147a1be-99ae-4240-86b0-6b03b9f3124f' est introuvable sur 'AM0PR10A01DC006.EURPR10A001.PROD.OUTLOOK.COM'. > Au caractère C:\Users\administrateur.xxxxx\AppData\Local\Temp\tmpEXO_ubelwxyd.eqn\tmpEXO_ubelwxyd.eqn.psm1:1098 : 13 > + Write-ErrorMessage $ErrorObject > + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > + CategoryInfo : NotSpecified: (:) [Add-UnifiedGroupLinks], ManagementObjectNotFoundException > + FullyQualifiedErrorId : [Server=VI1PR10MB3277,RequestId=455436cd-5751-2c3a-a72c-6143f047eaf1,TimeStamp=Fri, 06 Jan 2023 10:11:23 GMT],Write-ErrorMessage

    alors que quand je test la commande, j'ai bien un retour

    > PS C:\Users\administrateur.xxxxx> Get-MgUserTransitiveMemberOf -UserId $emailcopyoffice365 | ? {$.AdditionalProperties['mailEnabled'] -eq 'True'} | Foreach-Object { Get-MgGroup -Filter "Id eq '$($.id)'" } > > Id DisplayName Description GroupTypes > -- ----------- ----------- ---------- > b147a1be-99ae-4240-86b0-6b03b9f3124f dechet-ford-olivet {} > > > PS C:\Users\administrateur.xxxx> Get-MgUserTransitiveMemberOf -UserId $emailcopyoffice365 | ? {$.AdditionalProperties['mailEnabled'] -eq 'True'} | > >> ^C > PS C:\Users\administrateur.xxxx> Get-MgUserTransitiveMemberOf -UserId $emailcopyoffice365 | ? {$.AdditionalProperties['mailEnabled'] -eq 'True'} > > Id DeletedDateTime > -- --------------- > b147a1be-99ae-4240-86b0-6b03b9f3124f > > > PS C:\Users\administrateur.xxxx> Get-MgUserTransitiveMemberOf -UserId $emailcopyoffice365 | ? {$.AdditionalProperties['mailEnabled'] -eq 'True'} | Foreach-Object { Get-MgGroup -Filter "Id eq '$($.id)'" } > > Id DisplayName Description GroupTypes > -- ----------- ----------- ---------- > b147a1be-99ae-4240-86b0-6b03b9f3124f dechet-ford-olivet {}

    Quelle erreur es-je commis ?

    0 comments No comments

  4. Rich Matheisen 47,596 Reputation points
    2023-01-06T16:31:13.44+00:00

    What type of authentication are you using?

    From the Add-UnifiedGroupLinks help:

    Note: You can't use this cmdlet to modify Microsoft 365 Group members, owners, or subscribers if you connect using certificate based authentication (also known as CBA or app-only authentication for unattended scripts) or Azure managed identity. You can use Microsoft Graph instead. For more information, see Group resource type.

    0 comments No comments

  5. Florent GUILLOT 1 Reputation point
    2023-01-09T08:58:16.727+00:00

    Bonjour,

    oui je suis connecté avec un certificat, donc il faut que je trouve la commande équivalent en mode "Graph"?

    cordialement


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.