Office 365, setting mailbox permissions

      No Comments on Office 365, setting mailbox permissions

While looking for a method to migrate Office 365 mail i have notices that quite a few blogs copy/paste information without actually testing the procedure.

$AdminUser = berrydejager
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session

$MBXS = Get-Recipient -RecipientType UserMailbox

ForEach ($MBX in $MBXS)
{
Write-Host $MBX.name
Add-MailboxPermission $MBX.name -User $AdminUser -AccessRights FullAccess -InheritanceType All

Write-Host $MBX.name
$PSTFile = "C:\_PST\Mailbox_$MBX.name.pst" ## add Your new PST file name path
Write-Host $PSTFile
$outlook = New-Object -ComObject outlook.application
$namespace = $Outlook.GetNameSpace("MAPI")
$NameSpace.AddStore($PSTFile) ## Add the new PST to the Current profile
$NEWStore = $namespace.Stores | ? {$_.filepath -eq $PSTFile} ## Get the New Store
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.