Hello all,
I discovered some strange behavior this morning with the ExchangeOnlineManagement module from the PSGallery, and joined the forums to see if one the wizards here can tell us what’s going on.
After importing the module and connecting to EXO tenant, we discovered that issuing (mailbox) in the shell will list all the mailboxes in the tenant as if running the Get-Mailbox
cmdlet with unlimited results. However, Get-Command
does not find a command or function for mailbox
.
Steps to reproduce the behavior:
# Install the module
Install-Module -Name ExchangeOnlineManagement -Force
# Connect to EXO and log in
Connect-ExchangeOnline
# List all mailboxes for the tenant
Get-Mailbox -ResultSize Unlimited
# Running (mailbox) returns the same output as the above cmdlet (see screenshot below)
(mailbox)
Get-Command -Name "mailbox" # returns an error
Screenshot for reference:
Enclosing the “mailbox” in parenthesis I believe is performing some sort of sub-expression or evaluating the expression first before executing the next step. Similar to member access enumeration, the object is enumerated first, and then the property is accessible (Please correct me here if I’m mistaken). What is strange in this instance, mailbox
is not a cmdlet, function, or script, so it fails. However, running it in parenthesis returns all mailboxes.
Also to note, the ExchangeOnlineManagement module when imported adds the module as expected. However, once connecting to ExchangeOnline, it imports a temporary module. I tried to do my due diligence before posting here, and made sure to review all the cmdlets and functions in each module first, but no luck.
Any insight to understand what is going here will be greatly appreciated! Thank you!