Exchange Connection Problems

How to Fix PowerShell Hangs When Connecting to Exchange Online

Kushani NimanthikaKushani Nimanthika Nov 2, 2026 870 views

Question details

The user needs a way to resolve an issue where PowerShell completely stops responding immediately after entering administrator credentials to connect to Exchange Online.

How to Fix PowerShell Hangs When Connecting to Exchange Online
Product
Exchange Online
Device & OS
Windows / Azure Server
Scenario
Attempting to establish a remote PowerShell session to manage Exchange Online from a local computer or an Azure server.
Observed behavior
PowerShell hangs and fails to return a usable command prompt after credentials are submitted, often due to lingering or stalled sessions on the server side.
Before you start

Verify that your internet connection is stable and ensure you are using the latest version of the ExchangeOnlineManagement module before attempting to reconnect.

Solution 1Recommended

Allow Stalled Server Sessions to Expire

The most common reason for this hang is an active but unresponsive session on the Exchange server. Letting the session naturally time out will clear the connection block.

Exchange Online limits the number of concurrent PowerShell sessions an admin can have open. If a previous script or connection was closed improperly, the server still registers it as active.

When you attempt to connect again, the server cannot allocate a new session, causing the local PowerShell window to freeze while waiting for a response.

1
Force close PowerShell

Click the 'X' on your current frozen PowerShell window, or use Task Manager (Ctrl + Shift + Esc) to end the PowerShell background process.

2
Wait for backend timeout

Wait for the stalled sessions on the Exchange server to automatically expire. This typically takes 15 to 30 minutes, though in some severe cases, administrators report needing to wait a few hours or overnight.

3
Launch a fresh session

Open a new PowerShell window by right-clicking the Start menu and selecting 'Windows PowerShell (Admin)'.

4
Reconnect to Exchange

Run your standard 'Connect-ExchangeOnline' cmdlet and enter your credentials. The prompt should now return successfully.

Allow Stalled Server Sessions to Expire
Timeout Success: Many users, especially those operating on Azure servers, report that simply waiting out the server-side session expiration completely resolves the freezing issue without requiring complex script interventions.
Free Microsoft Office alternative

Simplify Your Workflow with WPS Office

Troubleshooting backend Microsoft Exchange Server problems and hung PowerShell modules can disrupt your entire workday. While IT resolves the server connectivity, keep your business moving with WPS Office. It provides a robust, lightweight, and completely free alternative to heavy Office installations.

Save time on document productivity while waiting for complex Exchange server and PowerShell issues to resolve.Fully compatible with Microsoft Office formats, ensuring you can seamlessly open, edit, and save .docx, .xlsx, and .pptx files.Lightweight architecture that avoids the heavy background processes often associated with other enterprise software suites.Features a familiar, tabbed interface so you can start working immediately with zero learning curve.
microsoft office alternative - wps office

Frequently Asked Questions

Why does PowerShell hang only when connecting to Exchange Online from my Azure server?

Azure servers frequently utilize shared IPs or specific network security group (NSG) rules. If a previous Exchange Online connection dropped silently due to a network timeout, the server-side session remains active. When you try to reconnect from the same environment, the module hangs waiting for the previous connection state to clear.

Can I prevent stalled sessions when using Exchange Online PowerShell?

Yes. The best way to prevent stalled sessions is to always gracefully close your connection when you finish your administrative tasks. Run the 'Disconnect-ExchangeOnline' cmdlet at the end of every script or manual session to explicitly tell the server to free up the connection.

How long does a stalled Exchange PowerShell session take to clear?

By default, idle Exchange Online PowerShell sessions are designed to time out after about 15 to 30 minutes on the server side. However, if the session is locked in a stalled state rather than simply idle, users sometimes have to wait several hours for the backend maintenance processes to drop the connection.

Does updating the ExchangeOnlineManagement module fix the freezing issue?

Updating to the latest version of the ExchangeOnlineManagement (EXO V3) module is highly recommended. Newer module versions handle REST API connections and modern authentication much better than older versions, reducing the chances of credentials causing a terminal hang.