Forum Discussion

DVanorder's avatar
DVanorder
Copper Contributor
Aug 05, 2022

Get-MailboxPermission always looks at on-prem DC versus EXO

Running Powershell 5.1 on a Windows VM with Exchange Management Shell v15 installed, along with 2.0.6 of the EXO PoSh module.

 

I'm trying to add permissions to a shared mailbox in Exchange Online. I load the modules, Connect-ExchangeOnline, and run Get-MailboxPermission -identity $mailbox. I never use the -domaincontroller switch. The cmdlet always returns that it cannot find the mailbox on one of the on-prem domain controllers.

 

I must be doing something wrong, but not sure what. How do I get this to only look in EXO? Any advice is greatly appreciated, and thanks in advance!

  • Use regular PowerShell to connect to ExO, instead of the EMS? This should prevent session overlap. Adding a session prefix is another option.
    • DVanorder's avatar
      DVanorder
      Copper Contributor

      VasilMichev Thank you for the quick reply! Would you mind explaining a little more--not sure I follow. Should have mentioned that I'm not an Exchange admin. It would seem that Exchange cmdlets like this that can run in both on prem and EXO would have a switch to indicate which environment it should run in. 

      • VasilMichev's avatar
        VasilMichev
        MVP
        They don't have a switch, the cmdlets names are the same, with some differences in parameters. Thus if you already have a session opened against your Exchange server (happens by default when you launch the EMS) and connect to Exchange Online, you're effectively duplicating (most of) the cmdlets. You can use the Connect-ExchangeOnline with the -Prefix parameter, or simply open a regular PowerShell console and connect from there.

Resources