Most useful PowerShell commands for Exchange
From Tech-Wiki
More actions
Common PowerShell starting points for supported Exchange Server and Exchange Online administration.
Validation status
Reviewed against current Microsoft Exchange PowerShell documentation on 27 September 2026. Legacy Office 365 MSOnline and Basic-auth remote-PowerShell examples have been removed.
Use Exchange RBAC and change control
Exchange cmdlets can affect mail flow, mailbox access, retention and availability. Use the least-privileged Exchange role required and validate bulk changes before applying them.
Exchange Server
Useful discovery commands:
Get-ExchangeServer Get-MailboxDatabase -Status Get-MailboxDatabaseCopyStatus *
Get-Mailbox -ResultSize Unlimited |
Select-Object DisplayName,UserPrincipalName,PrimarySmtpAddress
Remote Exchange Server PowerShell
$Credential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange `
-ConnectionUri http://mail01.example.com/PowerShell/ `
-Authentication Kerberos `
-Credential $Credential
Import-PSSession $Session -DisableNameChecking
Remove the session when finished:
Disconnect the on-premises session
Remove-PSSession $Session
Exchange Online
Use the Exchange Online PowerShell module and modern authentication:
Connect to Exchange Online
Install-Module ExchangeOnlineManagement Connect-ExchangeOnline -UserPrincipalName [email protected]
Disconnect
Disconnect-ExchangeOnline
Permission examples
Review mailbox permissions
Get-MailboxPermission [email protected]
Grant Full Access
Add-MailboxPermission [email protected] -User [email protected] -AccessRights FullAccess -InheritanceType All