Top 10 Microsoft 365 Exchange Admin PowerShell Scripts!
PowerShell is a powerful tool for managing Microsoft 365 Exchange. These ten useful cmdlets will help you automate tasks and streamline management.
-
Get-MailboxStatistics
Description: Retrieves mailbox statistics such as size, item count, and last logon times.
$Mailbox = "user@example.com" Get-MailboxStatistics -Identity $Mailbox
-
Get-MailboxPermission
Description: Lists permissions assigned to a specific mailbox or group of mailboxes.
$Mailbox = "user@example.com" Get-MailboxPermission -Identity $Mailbox
-
Get-DistributionGroupMember
Description: Lists members of a distribution group.
$DistributionGroup = "SalesGroup" Get-DistributionGroupMember -Identity $DistributionGroup
-
New-MailboxExportRequest
Description: Initiates mailbox exports to PST files.
$Mailbox = "user@example.com" New-MailboxExportRequest -Mailbox $Mailbox -FilePath "\\FileServer\Backups\UserMailbox.pst"
-
Get-MessageTrace
Description: Performs message trace queries to investigate email delivery issues.
$Sender = "sender@example.com" $Recipient = "recipient@example.com" Get-MessageTrace -SenderAddress $Sender -RecipientAddress $Recipient
-
Get-InboxRule
Description: Retrieves Inbox rules set by users.
$Mailbox = "user@example.com" Get-InboxRule -Mailbox $Mailbox
-
Set-MailboxAutoReplyConfiguration
Description: Configures automatic replies (Out of Office) for users.
$Mailbox = "user@example.com" Set-MailboxAutoReplyConfiguration -Identity $Mailbox -AutoReplyState Enabled -ExternalMessage "Out of Office message"
-
New-InboxRule
Description: Creates custom Inbox rules for users.
$Mailbox = "user@example.com" New-InboxRule -Mailbox $Mailbox -Name "Move Important Emails" -MoveToFolder "Inbox\Important" -From "important@example.com"
-
Set-CalendarProcessing
Description: Configures calendar processing settings for resource mailboxes.
$ResourceMailbox = "ConferenceRoom@example.com" Set-CalendarProcessing -Identity $ResourceMailbox -AutomateProcessing AutoAccept -AllowConflicts $false
-
Get-MobileDeviceStatistics
Description: Retrieves statistics for mobile devices connected to user mailboxes.
$Mailbox = "user@example.com" Get-MobileDeviceStatistics -Mailbox $Mailbox
Remember to connect to Exchange Online using the PowerShell module and ensure you have the necessary permissions before running these scripts. Always test in a non-production environment before deploying in a live environment. Happy PowerShell scripting!