Using PowerShell on Linux to Check Office 365 Mailbox Permissions

In a previous post I installed PowerShell on my Arch Linux based system. Here I use it to check and amend Office 365 mailbox permissions.

[andy@home-pc ~]$ pwsh
PowerShell 6.1.1
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

PS /home/andy> $credential = Get-Credential

PowerShell credential request
Enter your credentials.
User: [email protected]
Password for user [email protected]: **********

PS /home/andy> $ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $credential -Authentication "Basic" -AllowRedirection
PS /home/andy> 
PS /home/andy> Import-PSSession $ExchangeSession

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.0        tmp_0yjqlacy.r2b                    {Add-DistributionGroupMember, Add-Mailbox...

PS /home/andy> 
PS /home/andy> Get-MailboxFolderPermission -Identity [email protected]:\Calendar

FolderName           User                 AccessRights                   SharingPermissionFlags
----------           ----                 ------------                   ----------------------
Calendar             Default              {AvailabilityOnly}             
Calendar             Anonymous            {None}                         
Calendar             everyone             {Reviewer}                     

PS /home/andy>

If you needed to give everyone Reviewer access, you would issue something like the below:

PS /home/andy> Get-MailboxFolderPermission -Identity [email protected]:\Calendar -User everyone -AccessRights Reviewer

To disconnect, issue:

PS /home/andy> Get-PSSession | Remove-PSSession

Be the first to comment

Leave a Reply