Skip to content

MBaranekTech/M365

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 

Repository files navigation

M365

๐Ÿ“– What is shared mailbox

Shared mailboxes donโ€™t require a separate license.
Multiple users can send/receive mail from one address.
Calendar included โ€” useful for team scheduling.
Permissions-based access (Read, Send As, Send on Behalf).

How to Add to your M365 environment shared mailboxes via PowerShell script

param (
    [Parameter(Mandatory=$true)]
    [string]$MailboxName,

    [Parameter(Mandatory=$true)]
    [string]$EmailAddress,

    [Parameter(Mandatory=$true)]
    [string[]]$Users
)

# Connect to Exchange Online
Write-Host "Connecting to Exchange Online..." -ForegroundColor Cyan
Connect-ExchangeOnline -UserPrincipalName (Read-Host "Enter your admin UPN")

# Create the shared mailbox
Write-Host "Creating shared mailbox: $MailboxName <$EmailAddress>" -ForegroundColor Green
New-Mailbox -Name $MailboxName -Shared -PrimarySmtpAddress $EmailAddress

# Assign permissions to users
foreach ($user in $Users) {
    Write-Host "Granting Full Access and Send As permissions to $user..." -ForegroundColor Yellow

    Add-MailboxPermission -Identity $MailboxName -User $user -AccessRights FullAccess -InheritanceType All
    Add-RecipientPermission -Identity $EmailAddress -Trustee $user -AccessRights SendAs -Confirm:$false
}

# Confirm creation
Write-Host "`nShared mailbox created and permissions assigned successfully." -ForegroundColor Green

# Disconnect
Disconnect-ExchangeOnline

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published