Skip to content

Grant and Revoke Access to Mailboxes – Office 365

September 11, 2012

One client that I work with has the new SharePoint online. For a specific project, I had to create more than one hundred users and all of them didn’t want to use their exchange account, so I had to come up with a solution. I’ve created a script to redirect their emails to their personal accounts.
Below I will demonstrate how to:

add-MailboxPermission -Identity user@domain.com -User admin -AccessRights fullaccess
new-inboxrule -name “Redirect to personal hotmail” -mailbox user@domain.com -redirectto user@gmail.com
remove-MailboxPermission -Identity user@domain.com -User admin -AccessRights fullaccess

More info below how to grant access:

  • Grant an Admin access to a single mailbox
  • Grant an Admin access to all mailboxes
  • Revoke the above permissions (recommended cause of action after the Administrator has finished his/her tasks)
  1. First make sure you have the remote signed execution policy set to true. You can do this by running PowerShell in admin mode and running: Set-ExecutionPolicy RemoteSigned
  2. Next, run the following to authenticate your self and import PowerShell commands to your local session:
    $LiveCred = Get-Credential
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange-ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
    Import-PSSession $Session

Grant an Admin access to a single mailbox

  • Add-MailboxPermission user@domain.com -User admin@domain.com -AccessRights FullAccess -InheritanceType All

Grant an Admin access to all mailboxes

  • Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox') -and (Alias -ne 'Admin')} | Add-MailboxPermission -User admin@domain.com -AccessRights fullaccess -InheritanceType all

Revoke the above permissions

  • If you want to revoke permissions after granting them, simply replace the ‘Add-MailboxPermission‘ with ‘Remove-MailboxPermission‘ followed by the original command you entered to grant the permissions. For example, to grantadmin@example.com full access to user@example.com, you would enter the command:
    Add-MailboxPermission user@example.com -User admin@example.com -AccessRights FullAccess -InheritanceType All
  • To revoke admin@example.com from viewing user@example.com, you would enter the command:
    Remove-MailboxPermission user@example.com -User admin@example.com -AccessRights FullAccess -InheritanceType All
Advertisements

From → SharePoint 2010

One Comment
  1. Reblogged this on Sutoprise Avenue, A SutoCom Source.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: