IT Reference & Tools Back to Launchpad PowerShell Basics

IT Reference Library

Quick access to Microsoft Knowledge Base and essential diagnostic commands.

Microsoft Knowledge Base

Command Cheat Sheet

Connect to Exchange Online Establishes a PowerShell session to Exchange Online.
Connect-ExchangeOnline -UserPrincipalName admin@domain.com
Check Mailbox Statistics View mailbox size, item count, and last logon time.
Get-MailboxStatistics -Identity user@domain.com | Format-List DisplayName,ItemCount,TotalItemSize,LastLogonTime
Set Out of Office (Auto Reply) Configure an auto-reply for a specific user.
Set-MailboxAutoReplyConfiguration -Identity user@domain.com -AutoReplyState Enabled -InternalMessage "I am out of the office." -ExternalMessage "I am out of the office."
Grant Full Access Delegate Permission Give an admin or manager full access to another mailbox.
Add-MailboxPermission -Identity target@domain.com -User admin@domain.com -AccessRights FullAccess -InheritanceType All
Grant Send As Permission Allow a user to send emails from a shared mailbox.
Add-RecipientPermission -Identity shared@domain.com -Trustee user@domain.com -AccessRights SendAs
Message Trace (Last 48 Hours) Find emails sent to a specific user recently.
Get-MessageTrace -RecipientAddress user@domain.com -StartDate (Get-Date).AddDays(-2) -EndDate (Get-Date)