Microsoft 365 features that help users manage their subscriptions, account settings, and billing information.
Failing for me, 2020-09-17, all syntaxes applied. Friedrich's form filled out. We're subscribed to Microsoft 365, and our people are in AzureAD. I'm not sure whether this thread is the answer to my issue, but the error messages are identical.
All my scripts that used to work now get as far as "Creating implicit remoting module", a download, then fail at Import-PSSession $Session. $UserCredential = various forms of collecting credentials
Old connection method that used to work but now fails
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic –AllowRedirection
Import-PSSession $Session
Result:
Import-PSSession : Data returned by the remote Get-FormatData command is not in the expected format.
At nameofmyscript.ps1:6 char:1
- Import-PSSession $Session
-
+ CategoryInfo : InvalidResult: (:) [Import-PSSession], ArgumentException
+ FullyQualifiedErrorId : ErrorMalformedDataFromRemoteCommand,Microsoft.PowerShell.Commands.ImportPSSessionCommand
+other failures due to the above failure
Just prior to below, I installed PowerShellGet so I could install EXO V2 as per About the Exchange Online PowerShell V2 module so I can start connecting using non-basic authentication methods, in case that was part of the problem. Nope.
I can't connect to Exchange Online PowerShell; although I can Import-Module ExchangeOnlineManagement in order to get to the point I can connect without MFA, Connect-ExchangeOnline -Credential $UserCredential -ShowProgress $true does the same "Creating implicit remoting module", a download, then consistently fails with the same error:
Import-PSSession : Data returned by the remote Get-FormatData command is not in the expected format.
At C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\1.0.1\ExchangeOnlineManagement.psm1:454 char:40
- ... oduleInfo = Import-PSSession $PSSession -AllowClobber -DisableNameChe ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (:) [Import-PSSession], ArgumentException
+ FullyQualifiedErrorId : ErrorMalformedDataFromRemoteCommand,Microsoft.PowerShell.Commands.ImportPSSessionCommand
**Connect-ExchangeOnline -UserPrincipalName ****@mycompany.com -ShowProgress $true fails with
Import-PSSession : Data returned by the remote Get-FormatData command is not in the expected format.
At C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\1.0.1\ExchangeOnlineManagement.psm1:454 char:40
- ... oduleInfo = Import-PSSession $PSSession -AllowClobber -DisableNameChe ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (:) [Import-PSSession], ArgumentException
+ FullyQualifiedErrorId : ErrorMalformedDataFromRemoteCommand,Microsoft.PowerShell.Commands.ImportPSSessionCommand
Connect-ExchangeOnline -ConnectionUri "https://outlook.office365.com/powershell-liveid?SerializationLevel=Full" fails with
Import-PSSession : Data returned by the remote Get-FormatData command is not in the expected format.
At C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\1.0.1\ExchangeOnlineManagement.psm1:454 char:40
- ... oduleInfo = Import-PSSession $PSSession -AllowClobber -DisableNameChe ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (:) [Import-PSSession], ArgumentException
+ FullyQualifiedErrorId : ErrorMalformedDataFromRemoteCommand,Microsoft.PowerShell.Commands.ImportPSSessionCommand
For a guy who's just at the head end of learning PowerShell, this isn't as much fun as it looks. And as it turns out, I'm not learning it just for fun. This is preventing me from getting actual work done. :-(