How to Fix Connect-ExchangeOnline SHA256Cng and Syntax Errors in PowerShell
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.

- 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.
Ensure you are running PowerShell with Administrator privileges and have an active internet connection to download module updates.
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.
Open PowerShell as an Administrator and execute the command: Update-Module -Name ExchangeOnlineManagement. This ensures you have the latest compatible version.
Type your connection command using real values. For example: Connect-ExchangeOnline -UserPrincipalName yourname@example.com -ShowProgress $true.
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.

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. Download the Installer: Visit the official WPS Office website and download the free installation package for your operating system.
- 2. Install WPS Office: Run the downloaded setup file and follow the quick on-screen instructions to complete the installation.
- 3. Open Your Documents: Launch WPS Office to instantly open, edit, and save your existing Microsoft Office files with perfect formatting retention.

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 (< >).




