Get-EXOMailbox Returns nothing

noremaC1337 96 Reputation points
2021-02-11T19:57:14.957+00:00

I assume this is a permissions issue. I am new to Exchange online cmdlets and Exchange online as a whole. I am able to run Connect-ExchangeOnline, log in and everything successfully. I can run a few commands that return expected results (Get-User returns my "Name" and "RecipientType"; Get-EXORecipient returns a a large amount of information on various users). The main thing I am wanting to do is check mailbox quotas, and check retention rules that users have applied to them.

https://learn.microsoft.com/en-us/powershell/module/exchange/get-exomailbox?view=exchange-ps

The link above explains in example one how easy it is to run this command and what you should expect, but, again, I must be missing an assumed or prereq on all the pages I have visited for an answer as it appears it should be as easy as running the command.

Can someone point me in the direction of how to get Get-EXOMailbox to pull back some results?

Edit: I wanted to add, in case anyone is starting out completely new with Exchange Online like myself, that you get the Connect-Exchange cmdlet by installing the ExchangeOnlineManagement module.

Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,568 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,547 questions
{count} votes

Accepted answer
  1. noremaC1337 96 Reputation points
    2021-02-12T14:44:53.303+00:00

    Answer: Make sure you are actually using Exchange Online before trying to run Exchange Online commands

    As mentioned before, I am new to Exchange/Exchange Online and for that matter, to my current company. I very much appreciate the responses here.

    I have found that I was mistaken on thinking we were using Exchange Online. We actually are hosting Exchange on prem. I found that I can get onto the local exchange server, and open the "Exchange Management Shell" and I am able to type the commands in that @Yuki Sun-MSFT mentioned and they are working as I expected. This was the information I was originally after.

    I have also found that you can use this link:

    https://learn.microsoft.com/en-us/powershell/exchange/connect-to-exchange-servers-using-remote-powershell?view=exchange-ps

    to create a remote session and run the old non-EXO commands as well from my local workstation.

    As disappointed as I am with not knowing the facts before posting this thread, you all have sparked many more questions about these technologies (Azure AD, Exchange Online, Exchange Server) which will encourage me to pursue further knowledge in these areas of IT as well, which as we all know is half the fun of being in IT! Thank you guys again.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Rich Matheisen 46,806 Reputation points
    2021-02-11T20:40:18.237+00:00

    In addition to Andy David's comment, I don't think that the Get-EXOMailbox is going to return anything that would be useful to you, The EXO stuff returns a PSCustomObject that contains deserialized data (i.e. a text representation). The EXO cmdlets are great for returning much smaller datasets that take a lot less time to move over the network, but there are only a limited number of mailbox properties that are returned, and there are no methods in there at all:

    Name                      MemberType
    ----                      ----------
    Alias                     NoteProperty
    DisplayName               NoteProperty
    DistinguishedName         NoteProperty
    EmailAddresses            NoteProperty
    ExchangeVersion           NoteProperty
    ExternalDirectoryObjectId NoteProperty
    Guid                      NoteProperty
    Id                        NoteProperty
    Identity                  NoteProperty
    Name                      NoteProperty
    OrganizationId            NoteProperty
    PrimarySmtpAddress        NoteProperty
    RecipientType             NoteProperty
    RecipientTypeDetails      NoteProperty
    UserPrincipalName         NoteProperty
    
    0 comments No comments

  2. Yuki Sun-MSFT 41,146 Reputation points Microsoft Vendor
    2021-02-12T07:49:57.907+00:00

    Hi @noremaC1337 ,

    To check mailbox quotas and retention policy applied to a mailbox, the following command can be used:

    Get-EXOMailbox -Identity <username> -PropertySets Quota,retention  
    

    Then as regards to the current situation that get-exomailbox returns only one result and you are suspecting a different environment is connected, please check the returned properties and verify the tenant from the suffix of the email address or the value of OU:

    67280-1.png

    By the way, it's suggested to try running the old get-mailbox command and see if the expected users can be returned. If yes, you can also check the quotas or retention policy using the following command:

    get-mailbox <username> | fl name,*quota*, retentionpolicy  
    

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

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.