Posted On July 27, 2019

Barracuda Message Archiver & Office 365 Exchange Online Service Account Configuration

kimconnect 0 comments
blog.KimConnect.com >> Codes >> Barracuda Message Archiver & Office 365 Exchange Online Service Account Configuration

The following script grant an Office 365 Exchange online service account necessary permissions on Exchange Server to enable the Barracuda Message Archiver access to all mailboxes.

# Office 365 Global Admin Credential
$username="[email protected]"
$password=ConvertTo-securestring "PASSWORD" -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username,$password
# $cred = Get-Credential

# Connect to Office 365
if (!(Get-Module -ListAvailable -Name MSOnline)){Install-Module MSOnline -Confirm:$false -Force;}
$O365Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $O365Session -AllowClobber

# Set permissions for Barracuda service account for all mailboxes on O365
$serviceAccount="[email protected]"
Get-Mailbox -ResultSize unlimited | Add-MailboxPermission -User $serviceAccount -AccessRights fullaccess -InheritanceType all -Automapping $false

Note: as newly created accounts will not inherit the newly set permissions unless access grants are triggered, this script should be set to run as a scheduled task; in which case, the plain-text password credential method should be converted to XML creds (I have that snippet somewhere on this site) and saved to a local directory for subsequent execution.

Leave a Reply

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

Related Post

PowerShell: Check Active Directory Username Collisions

$originalCsvFile='C:\Users\rambo\Desktop\Usernames.csv' $newCsvFile='C:\Users\rambo\Desktop\Usernames-processed.csv' function checkUsernameCollisions($originalCsv,$newCsv){ $csvContents=import-csv $originalCsv write-host "Pulling existing records from Active Directory of $env:USERDNSDOMAIN..."…

PowerShell: How To Make A System App Do Nothing

# How-To-Make-Existing-System-App-Do-Nothing.ps1# Provide variables$hive="REGISTRY::HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WORDPAD.EXE"$key="(default)"$value="C:\Windows\dummy.exe"$defaultValue="C:\Program Files\Windows NT\Accessories\WORDPAD.EXE"# Dummy-File-Creator.ps1$dummyFile="C:\Windows\dummy.exe"$output = new-object byte[] 1; (new-object Random).NextBytes($output);[IO.File]::WriteAllBytes($dummyFile, $output);if…

PowerShell: Use Regex to Select IPv4 Patterns

# This example shows how to obtain ip address of the $env:logonserver$logonServerIP=nltest /DSGETDC:$regexIP = [regex]…