Nov 12 2020 06:18 AM
So we have MFA enabled on our Office 365 accounts. From my Windows 10 computer, I can connect to the ExchangeOnlineManagement module without issue. However, on my DC I installed Powershell 7.0.3, then successfully installed the ExchangeOnlineManagement module. I can successfully import the module, however when I attempt to connect to it I get the below error. Any ideas?
PS C:\Windows\System32> Connect-ExchangeOnline -UserPrincipalName MyUsername -ShowProgress $true
----------------------------------------------------------------------------
The module allows access to all existing remote PowerShell (V1) cmdlets in addit
ion to the 9 new, faster, and more reliable cmdlets.
|--------------------------------------------------------------------------|
| Old Cmdlets | New/Reliable/Faster Cmdlets |
|--------------------------------------------------------------------------|
| Get-CASMailbox | Get-EXOCASMailbox |
| Get-Mailbox | Get-EXOMailbox |
| Get-MailboxFolderPermission | Get-EXOMailboxFolderPermission |
| Get-MailboxFolderStatistics | Get-EXOMailboxFolderStatistics |
| Get-MailboxPermission | Get-EXOMailboxPermission |
| Get-MailboxStatistics | Get-EXOMailboxStatistics |
| Get-MobileDeviceStatistics | Get-EXOMobileDeviceStatistics |
| Get-Recipient | Get-EXORecipient |
| Get-RecipientPermission | Get-EXORecipientPermission |
|--------------------------------------------------------------------------|
To get additional information, run: Get-Help Connect-ExchangeOnline or check htt
ps://aka.ms/exops-docs
Send your product improvement suggestions and feedback to exocmdletpreview@servi
ce.microsoft.com. For issues related to the module, contact Microsoft support. D
on't use the feedback alias for problems or support issues.
----------------------------------------------------------------------------
New-ExoPSSession: C:\Users\jwcitadmin\Documents\PowerShell\Modules\ExchangeOnlin
eManagement\2.0.3\ExchangeOnlineManagement.psm1:426
Line |
426 | . PSSession = New-ExoPSSession -ExchangeEnvironmentName $ExchangeEnviro
.
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Could not load type 'System.Security.Cryptography.SHA256Cng' from
| assembly 'System.Core, Version=4.0.0.0, Culture=neutral,
| PublicKeyToken=b77a5c561934e089'..
Nov 12 2020 07:30 AM
I am not totally sure, but based on some reading I did there is a compatibility issues between Powershell 7 and ExchangeOnline, even though its almost 1 year post, but not sure if MS fix it or not.
https://github.com/PowerShell/PowerShell/issues/11070
I have the same case, and I am using Powershell 5.1 to manage Exchange Online, as it seems that Powershell Core is not compatible with the module.
even in Windows Event Log I have the following Warning:
Error Message = Could not load type 'System.Security.Cryptography.SHA256Cng' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'..
Fully Qualified Error ID = System.Exception,Microsoft.Exchange.Management.ExoPowershellSnapin.NewExoPSSession
Context:
Severity = Warning
Host Name = ConsoleHost
Host Version = 7.1.0
Host ID = d1434fc6-2c2d-4b64-8ca4-38ca5f6668c9
Host Application = C:\Program Files\PowerShell\7-preview\pwsh.dll -WorkingDirectory ~
Engine Version = 7.1.0
Runspace ID = d84be782-d5d3-413a-b7c1-a2ab71ab9e4f
Pipeline ID = 75
Command Name = New-ExoPSSession
Command Type = Cmdlet
Script Name = C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\2.0.3\ExchangeOnlineManagement.psm1
Command Path =
Sequence Number = 8
User = 266517A\User390
Connected User =
Shell ID = Microsoft.PowerShell
User Data:
---------------------------
If you find this answer helpful, Please click on Best Response and give like
Nov 12 2020 08:57 AM
@farismalaeb is correct, the ExO V2 module doesnt support PowerShell 7/Core yet. A preview version is available and GA should follow in the coming weeks/months.
Nov 25 2020 06:15 PM
Hi @VasilMichev , i am facing the same issue to use powershell script 7 to connect to ExchangeOnline.
Just wondering if you know what is current progress ? Thanks.
Nov 26 2020 05:03 AM
Oct 27 2021 01:30 AM
I have removed Powershell 7.1 (using control panel) and "Connect-ExchangeOnline" problem solved when my computer is running with Powershell 5.1.
Please mark this post if its a solution for your problem too.
Apr 11 2022 02:14 PM
Apr 11 2022 02:45 PM
Jun 29 2022 07:24 AM
Hi,
I've been struggling for more than 2 hours just to be able to get a simple user list from an Office 365 distribution list. I've installed PowerShell, downloaded a couple of modules, and at the end of the day still unable to get this fu$$^^ù$ user list. Just kill me guys, I don't understand why the online version offers to download a .csv file of all distribution lists, but not members (?????????). Just a non sens. Never seen a such environment leading to a so huge waste of time. Congrats Microsoft.