$User ="tom@A.onmicrosoft.com"
$PWord = ConvertTo-SecureString –String "Password" –AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User,$Pword
Import-Module MsOnline
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -Credential $Credential -ShowProgress $true
Get-Mailbox -ResultSize Unlimited | Add-MailboxPermission -AccessRights FullAccess -Automapping $false -User "tom@A.onmicrosoft.com"
Get-Mailbox -ResultSize Unlimited -Filter{(recipienttypedetails -eq 'usermailbox')-and (alias -ne 'Jerry')}| Add-MailboxPermission -AccessRights FullAccess -Automapping $false -User "tom@A.onmicrosoft.com"
Get-Mailbox -ResultSize Unlimited | Remove-MailboxPermission -AccessRights FullAccess -InheritanceType All -User "tom@Altade002.onmicrosoft.com"