Exchange Online PowerShell allows administrators to manage Office 365 mailboxes, configure settings, and automate tasks that are not available in the Microsoft 365 Admin Center. This guide will walk you through the installation and connection process for Exchange Online PowerShell.
Requirements
- Windows 10, Windows 11, or Windows Server 2016 and later.
- PowerShell version 5.1 or higher.
- Administrative privileges on the machine.
Step 1: Install the Exchange Online PowerShell Module
- Open PowerShell as Administrator
- Click Start, type PowerShell, right-click on Windows PowerShell, and select Run as administrator.
- Install the Exchange Online Management Module
Run the following command to install the module:powershellCopyEditInstall-Module ExchangeOnlineManagement
- Confirm the Installation
If prompted to install from an untrusted repository, type Y and press Enter. - Verify the Installation
Check if the module installed correctly by running:powershellCopyEditGet-Module ExchangeOnlineManagement -ListAvailable
Step 2: Connect to Exchange Online PowerShell
Method 1: Standard Authentication
For normal admin accounts, use:
Connect-ExchangeOnline -UserPrincipalName [email protected]
- Enter your Microsoft 365 admin credentials when prompted.
- A PowerShell session will establish a connection to Exchange Online.
Method 2: Multi-Factor Authentication (MFA)
If your account has MFA enabled, use:
Connect-ExchangeOnline -UserPrincipalName [email protected] -ShowProgress $true
A Microsoft sign-in window will appear to complete authentication.
Step 3: Verify Connection to Exchange Online
To confirm you’re connected, run:
Get-Mailbox
If you see a list of user mailboxes, you’re successfully connected.
Step 4: Disconnect When Done
To prevent session limits, disconnect when finished:
Disconnect-ExchangeOnline -Confirm:$false
Troubleshooting Installation Issues
- Module Not Found?
- Run
Update-Module ExchangeOnlineManagement
to update the module. - Restart PowerShell and try again.
- Run
- Permission Denied?
- Ensure you’re running PowerShell as Administrator.
- Check execution policies:powershellCopyEdit
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
- Cannot Connect?
- Verify your admin credentials.
- Check if your IP is blocked by Conditional Access policies.
Best Practices
✅ Always Disconnect – Close sessions when not in use to avoid connection limits.
✅ Use MFA for Security – Enforce Multi-Factor Authentication for admin accounts.
✅ Keep Modules Updated – Run Update-Module ExchangeOnlineManagement
regularly.