
Welkom at the Exchange online Powershell examples Wiki.
Before you are able to perform any of the below powershell examples, you will need to connect to Exchange online using powershell.
Steps on how to do this can be found on the: Howto – Install and Connect to Exchange online remote powershell with 2FA
Add calender permissions in a mailbox:
View the current permissions:
- Get-MailboxFolderPermission example.user@mydomain.com:\calendar
View the permissions for a specific user:
- Get-MailboxFolderPermission -Identity calendar@mydomain.com:\Calendar -User dude@mydomain.com
Add permissions to the calendar:
- Add-MailboxFolderPermission calendar@mydomain.com:\Calendar -User dude@mydomain.com -AccessRights Author
Note: AccessRights can be: Owner, PublishingEditor, Editor, PublishingAuthor, Author, NonEditingAuthor, Reviewer, Contributor, AvailabilityOnly, LimitedDetails
Remove permissions for a specific user
- Remove-MailboxFolderPermission -Identity calendar@company:\calendar -user dude@mydomain.com
What if you need to change the calendar permissions for all users within your organization?!
$allmailbox = Get-Mailbox -Resultsize Unlimited
Foreach ($Mailbox in $allmailbox)
{
$path = $Mailbox.alias + “:\” + (Get-MailboxFolderStatistics $Mailbox.alias | Where-Object { $_.Foldertype -eq “Calendar” } | Select-Object -First 1).Name
Set-mailboxfolderpermission –identity ($path) –user Default –Accessrights AvailabilityOnly
}
List all folders in a mailbox
Get-MailboxFolderStatistics -Identity username.e | select-object identity
Enable out of office message for a mailbox via powershell
Set-MailboxAutoReplyConfiguration -Identity <username> -AutoReplyState Enabled -InternalMessage “Internal auto-reply message.” -ExternalMessage “External auto-reply message.”
Export distribution group members to csv file
Get-DistributionGroupMember -identity “mydistributionlist” | export-csv -NoTypeInformation -path.\mydocument.csv -encoding utf8
Insert a mailbox rule to silently discard auto-reply messages
New-InboxRule -mailbox support.byteblower.kayakoqueue@excentis.com -Name NoAutoReplyMessages -SubjectContainsWords “Automatic reply” -DeleteMessage $true