Forum Discussion
DVanorder
Aug 05, 2022Copper Contributor
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....
VasilMichev
Aug 05, 2022MVP
Use regular PowerShell to connect to ExO, instead of the EMS? This should prevent session overlap. Adding a session prefix is another option.
DVanorder
Aug 05, 2022Copper 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.
- VasilMichevAug 06, 2022MVPThey 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.
- DVanorderAug 06, 2022Copper ContributorThank you again for your time and patience! -Prefix sounds like the solution. Unfortunately, it does not work. Here's what the script does. Not sure what I'm doing wrong:
1. Load Exchange Management PSSnapin
2. Create shared mailbox on-prem using New-RemoteMailbox, then Set-RemoteMailbox to add properties
3. Create distribution group on-prem using New-DistributionGroup, then Set-DistributionGroup to add properties
4. Wait for sync to O365, then connect to Exchange Online
5. Run Add-MailboxPermission and Add-RecipientPermission against the shared mailbox in O365
When connecting to EXO, I used Connect-ExchangeOnline -Prefix "DVO" and authenticated via the UI. I then verify I'm in with Get-EXOMailbox. I then tried Get-DVOMailboxPermission. Cmdlet not found is returned.- DVanorderAug 07, 2022Copper ContributorAlso--I see MSFT updated their EXO V2 documentation on 8/3. It documented a Get-EXOMailboxPermission cmdlet, which is a REST wrapper for Get-MailboxPermission. I ran it in debug after connecting to EXO and it returned a 401.
This may ultimately be a permissions issue.