How to Export and Apply User Mailbox Permissions, Shared Mailbox Permissions and Calendar Folder Permissions using Powershell, Managing SendAs and SendonBehalf (Office365 – Exchange Online)

|
, , | TechPress-KBID-248
Home » Office 365 » How to Export and Apply User Mailbox Permissions, Shared Mailbox Permissions and Calendar Folder Permissions using Powershell, Managing SendAs and SendonBehalf (Office365 – Exchange Online)

Export the Access Rights / Permissions assigned to All user mailboxes in Office365.

Get-Mailbox -RecipientType 'UserMailbox' -ResultSize Unlimited | Get-MailboxPermission | Export-Csv -NoTypeInformation C:\temp\usermailboxpermission.csv

List the Access Rights / Permissions for a user on all other mailboxes

Below command will list the full mailbox permissions which user1 have on all other mailboxes

Get-mailbox -resultsize unlimited | Get-MailboxPermission -user [email protected] | Select User, Identity, Accessrights

Export the Access Rights / Permissions assigned to All Shared Mailboxes in Office365

Get-Mailbox -RecipientType 'Shared' -ResultSize Unlimited | Get-MailboxPermission | Export-Csv -NoTypeInformation C:\temp\sharedmailboxpemission.csv

Export the Access Rights / Permissions assigned to All Shared Mailboxes in Office365 (Another Variation to Export only relevant information)

Get-Mailbox -RecipientType 'Shared' -ResultSize Unlimited | Get-MailboxPermission | Where {($_.User -ne 'NT AUTHORITY\SELF') -and ($_.IsInherited -eq $false) -and ($_.User -notlike 'admin') -and ($_.User -notlike 'S-1-5')} | Select Identity, User, AccessRights | Export-csv -NoTypeInformation C:\temp\Export01.csv

Export the Access Rights / Permissions for the Calendar Folder of all User Mailboxes.

ForEach ($Mailbox in (Get-Mailbox -ResultSize Unlimited)) { Get-MailboxFolderPermission -Identity "$($Mailbox.Name):\Calendar" | Select @{n='Mailbox';e={$Mailbox.Name}},User,AccessRights}

Another way to List Calendar Permissions

Get-Mailbox | %{Get-MailboxFolderPermission $_”:\calendar”} | ft Identity, User, AccessRights

You can filter the Calendar Folder Permissions to only list it for a particular user e.g. John. This will list all the users calendars where John is assigned any permission.

Get-Mailbox | %{Get-MailboxFolderPermission $_":\calendar"} | where {$_.user -like 'john*'} | ft Identity, User, AccessRights

Apply / Set Full Mailbox Permission for a Single User on All Mailboxes

Sometimes we have a requirement when performing User Mailbox Migration, we need to provide a user or administrator Full Mailbox rights so that we can use this account to migrate their emails. We can use below command to Add Full Mailbox Permission for a user e.g. [email protected]

Below command will provide [email protected] user Full Mailbox Permission on all user mailboxes except where the Alias is Admin.

Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox') -and (Alias -ne 'Admin')} | Add-MailboxPermission -User [email protected] -AccessRights fullaccess -InheritanceType all -AutoMapping:$false

Export SendAs Permission for all the users (Exchange 2010)

Get-Mailbox -resultsize unlimited | Get-ADPermission | where { ($_.ExtendedRights -like “*Send-as*”) -and ($_.IsInherited -eq $false) -and -not ($_.User -like “NT AUTHORITY\SELF”) } | ft -wrap

Export SendAs Permission for all the users (Office365)

Get-RecipientPermission -Identity * -AccessRights SendAs | Where {$_.Trustee -ne 'NT Authority\Self' -and $_.Trustee -ne 'NULL SID'}

Apply / Set  SendAs Permissions for a one User  (Office365)

Below Command will provide SendAs permissions to Jatin Makhija on John A Mailbox.

Add-RecipientPermission -Identity "John A" -Trustee "Jatin Makhija" -AccessRights SendAs

List SendOnBehalf Permission for all the users (Office365)

Get-Mailbox -Filter {GrantSendOnBehalfTo -ne $Null} | select DisplayName, PrimarySMTPAddress, GrantSendonbehalfto | ft -AutoSize -Wrap

Export SendOnBehalf Permission for all the users (Office365)

Get-Mailbox -Filter {GrantSendOnBehalfTo -ne $Null} | select DisplayName, PrimarySMTPAddress, GrantSendonbehalfto | Export-Csv -NoTypeInformation C:\temp\export-sendonbehalf.csv

Apply / Set SendOnBehalf Permission to a user (Office365)

Below command will provide [email protected] GrantSendonBehalf Permission on John A Mailbox.

Set-Mailbox "John A" -GrantSendOnBehalfTo @{Add="[email protected]"}

Get Regional Configuration for Office365 Users

Get-mailbox -ResultSize unlimited | get-MailboxRegionalConfiguration

Set Regional Configuration, TimeZone, DateFormat, Language on All Office 365 / Exchange Online mailboxes

 Get-mailbox -ResultSize unlimited | Set-MailboxRegionalConfiguration -Language 2057 -TimeZone "Greenwich Standard Time" -DateFormat dd/MM/yyyy -TimeFormat HH:mm

You can use below link to find more infomation about the Language ID (LCID) Information:

https://docs.microsoft.com/en-us/openspecs/office_standards/ms-oe376/6c085406-a698-4e12-9d4d-c3b0ee3dbc4a

Leave a Reply