Microsoft 365 Error Codes

How to Fix Connect-ExchangeOnline SHA256Cng and Syntax Errors in PowerShell

Steven ParkerSteven Parker Nov 3, 2026 870 views

Question details

The user is encountering a System.Security.Cryptography.SHA256Cng loading error and command parser errors when attempting to use the Connect-ExchangeOnline cmdlet.

Fix Connect-ExchangeOnline SHA256Cng and PowerShell Syntax Errors
Product
Microsoft PowerShell
Device & OS
not provided
Scenario
Attempting to connect to Exchange Online via PowerShell using the ExchangeOnlineManagement module.
Observed behavior
PowerShell throws a SHA256Cng cryptographic loading error, and syntax parser errors occur when users copy and paste command placeholders literally from documentation.
Before you start

Ensure you are running PowerShell with Administrator privileges and have an active internet connection to download module updates.

Solution 1Recommended

Update the ExchangeOnlineManagement Module and Remove Placeholders

Resolve compatibility issues by updating your module to the latest stable release, and fix syntax errors by replacing documentation placeholders with actual values.

The SHA256Cng error is typically caused by compatibility issues between preview builds of PowerShell (such as 7.1.0-rc.2) and older versions of the ExchangeOnlineManagement module (like 2.0.3). Updating the module resolves this cryptographic error.

Syntax parser errors usually happen because users include literal square brackets or angle brackets in their commands. These symbols are only used in Microsoft documentation to indicate optional parameters or placeholder text.

1
Update the PowerShell Module

Open PowerShell as an Administrator and execute the command: Update-Module -Name ExchangeOnlineManagement. This ensures you have the latest compatible version.

2
Format the Connection Command correctly

Type your connection command using real values. For example: Connect-ExchangeOnline -UserPrincipalName yourname@example.com -ShowProgress $true.

3
Remove Literal Documentation Brackets

When referencing Microsoft documentation, do not type angle brackets (< >) or square brackets ([ ]). Replace the entire placeholder, such as <Value>, with your actual environment name or credentials.

Update the ExchangeOnlineManagement Module and Remove Placeholders
Understanding Documentation Syntax: In PowerShell documentation, square brackets denote optional parameters. Angle brackets denote a placeholder where you must insert a specific value. Neither should be typed in your actual script.
Free Microsoft Office alternative

Manage Your Office Documents Effortlessly with WPS Office

While resolving Microsoft 365 server connections requires specialized PowerShell troubleshooting, handling your daily office documents shouldn't be complicated. WPS Office provides a free, lightweight, and highly compatible alternative to Microsoft Office, letting you focus on your work without frustrating technical errors.

  1. 1. Download the Installer: Visit the official WPS Office website and download the free installation package for your operating system.
  2. 2. Install WPS Office: Run the downloaded setup file and follow the quick on-screen instructions to complete the installation.
  3. 3. Open Your Documents: Launch WPS Office to instantly open, edit, and save your existing Microsoft Office files with perfect formatting retention.
Fully compatible with Microsoft Word, Excel, and PowerPoint formats (.docx, .xlsx, .pptx).Free, lightweight software that runs smoothly without draining system resources.Familiar user interface requires zero learning curve, making migration seamless.Built-in robust PDF editing toolkit to handle all document formats efficiently.
microsoft office alternative - wps office

Frequently Asked Questions

Why do I get a SHA256Cng error in PowerShell 7.1.0-rc.2?

This error often occurs due to compatibility issues with preview versions of PowerShell (like rc.2) and older versions of the ExchangeOnlineManagement module (such as 2.0.3). Updating both your module and PowerShell to stable releases usually resolves the cryptographic loading issue.

What do the square brackets mean in PowerShell documentation?

Square brackets [ ] indicate that a parameter or argument is optional. You should not type the brackets when executing the actual command in your console.

How do I correctly use the UserPrincipalName parameter?

Replace the documentation placeholder with your actual Microsoft 365 email address. For example, use `-UserPrincipalName admin@yourdomain.com` and ensure you do not include any angle brackets (< >).