
Before you begin
Use a patched, supported Windows 11 PC, or Windows 10 covered by an active ESU program or a still-supported LTSC release. Have your Microsoft 365 sign-in name and your organization’s tenant ID ready.
Confirm that your account can use Exchange Online PowerShell, has the Exchange permissions needed for your task, and meets your organization’s MFA and device requirements. Use the least-privileged suitable role; Global Administrator is not required just to connect.
These connection instructions cover Microsoft 365 commercial and GCC tenants. GCC High and DoD require different connection settings.
Check PowerShell version
Open Windows PowerShell or PowerShell 7 normally. Administrator elevation is not required for this current-user module installation. Run this command, then select the matching version below. If your version isn’t listed, don’t select the nearest version—check Microsoft’s compatibility guidance before continuing.
Use code with caution.
$PSVersionTable.PSVersion.ToString()Only module setup differs; sign-in and verification are shared.
These steps connect Windows PowerShell 5.1 on Windows 10 or 11, subject to the Windows support requirements above, to Exchange Online using Microsoft’s current module. .NET Framework 4.7.2 or later is required.
Example version output; your build numbers may differ:
5.1.26100.1
These steps connect PowerShell 7.6 on Windows 11 to Exchange Online using Microsoft’s current module.
Example version output; your build numbers may differ:
7.6.6
These steps connect PowerShell 7.4 or 7.5 on Windows 11 using module 3.9.2. Module 3.10.0 and later require PowerShell 7.6 or later when using PowerShell 7.
Example version output; your build numbers may differ:
7.4.20 / 7.5.11
PowerShell 7.4 and 7.5 reach end of support on November 10, 2026. Plan to move to a supported release.
Install Exchange module
Check whether ExchangeOnlineManagement is already available in this PowerShell application:
Get-Module -ListAvailable -Name ExchangeOnlineManagement | Select-Object Name, VersionCheck the version shown:
- Nothing listed: Run the installation command below.
- Only 3.10.x listed: Already installed—skip to Sign in to M365.
- Any other version listed: Check Microsoft’s compatibility guidance before continuing.
Install-Module -Name ExchangeOnlineManagement -Scope CurrentUser -Repository PSGallery- Nothing listed: Run the installation command below.
- 3.9.2 listed: Already installed—skip to Sign in to M365.
- Only other versions listed: Check Microsoft’s compatibility guidance before continuing.
Install-Module -Name ExchangeOnlineManagement -Scope CurrentUser -Repository PSGallery -RequiredVersion 3.9.2This installs the module from the PowerShell Gallery for your current Windows user only.
If prompted, approve the following if your organization permits them:
- NuGet provider
- PSGallery repository
Wait for the PowerShell prompt to return without an error.
Sign in to Microsoft 365
The connection command below loads the installed module automatically.
Load the compatible module version first:
Import-Module ExchangeOnlineManagement -RequiredVersion 3.9.2No output is normal after a successful import. If it fails, resolve the error before continuing.
Replace admin@example.com below with your Microsoft 365 administrator sign-in name—not your Windows username.
Connect-ExchangeOnline -UserPrincipalName 'admin@example.com'Complete Microsoft’s sign-in and MFA prompts if requested. When the command finishes, verify the connection.
Verify the account & tenant
Get-ConnectionInformation | Format-List UserPrincipalName, TenantID, State, IsEopSessionIllustrative output—not a live test result:
UserPrincipalName : admin@example.com TenantID : 11111111-2222-4333-8444-555555555555 State : Connected IsEopSession : False
Check that the account is yours, the tenant ID matches your organization’s known ID, State is Connected, and IsEopSession is False.
Find your Microsoft 365 tenant ID in the Microsoft Entra admin center under:
Entra ID (Identity) → Overview → Properties → Tenant ID.
This lookup requires at least Global Reader access. If you don’t have access, ask an authorized administrator for your tenant ID.
If details differ, no result appears, or unexpected extra connections appear, stop and resolve that before running Exchange commands.
Stay in this PowerShell window. If you close it, the module remains installed, but you’ll need to repeat Sign in to M365 in a new window—no reinstallation needed.
You can now run the Exchange Online commands within PowerShell.
Disconnect
Disconnect-ExchangeOnline -Confirm:$falseDisconnecting closes your Exchange connection cleanly and helps avoid reaching session limits. No confirmation prompt or output is expected.
Troubleshooting
“Running scripts is disabled”: if your organization permits it, open PowerShell as administrator and run:
Set-ExecutionPolicy RemoteSignedThis changes the computer-wide execution policy. Do not override a managed policy; ask IT if it remains blocked. Close that window, reopen PowerShell normally, and retry sign-in.
Sign-in fails: use a normal PowerShell window under your signed-in Windows user, not Run as different user. Your Microsoft 365 administrator account can still be different. If Microsoft rejects the device or sign-in, have your administrator review the access policy.
Connected, but a command is denied or missing: Confirm your account has the Exchange permissions required for that command.
“Could not load file or assembly”: Check that your PowerShell and Exchange module versions match the instructions above, then retry in a fresh PowerShell window before loading other modules. If the error persists, save the complete message—including the assembly name and version—for further troubleshooting.
References
- Module installation and version compatibility
- Connect to Exchange Online PowerShell
- Inspect connection details
- Disconnect from Exchange Online
- Execution policy settings
- Sign-in troubleshooting
- PowerShell support lifecycle
- Module installation scope and existing versions
- Windows 10 release and support information
- Windows 10 Extended Security Updates
- Find the permissions required for Exchange commands
- Find your Microsoft 365 tenant ID in Microsoft Entra
