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.

  1. Get-MailboxStatistics

    Description: Retrieves mailbox statistics such as size, item count, and last logon times.

    $Mailbox = "user@example.com"
    Get-MailboxStatistics -Identity $Mailbox
  2. Get-MailboxPermission

    Description: Lists permissions assigned to a specific mailbox or group of mailboxes.

    $Mailbox = "user@example.com"
    Get-MailboxPermission -Identity $Mailbox
  3. Get-DistributionGroupMember

    Description: Lists members of a distribution group.

    $DistributionGroup = "SalesGroup"
    Get-DistributionGroupMember -Identity $DistributionGroup
  4. New-MailboxExportRequest

    Description: Initiates mailbox exports to PST files.

    $Mailbox = "user@example.com"
    New-MailboxExportRequest -Mailbox $Mailbox -FilePath "\\FileServer\Backups\UserMailbox.pst"
  5. 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
  6. Get-InboxRule

    Description: Retrieves Inbox rules set by users.

    $Mailbox = "user@example.com"
    Get-InboxRule -Mailbox $Mailbox
  7. 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"
  8. 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"
  9. Set-CalendarProcessing

    Description: Configures calendar processing settings for resource mailboxes.

    $ResourceMailbox = "ConferenceRoom@example.com"
    Set-CalendarProcessing -Identity $ResourceMailbox -AutomateProcessing AutoAccept -AllowConflicts $false
  10. 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!

PowerShell Guide: Connect to Exchange Online with Ease

You may also like...

Leave a Reply