Microsoft 365 features that help users manage their subscriptions, account settings, and billing information.
UPDATE - Added "-delegatedorganization xxx.onmicrosoft.com" and now it connects to V2
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am unable to access exchange online via powershell anymore. it has been about 2 or 3 months since i have tried but this used to work with no issues.
I have tried connecting 3 ways, all of which fail with the same error
#1
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession -Session $Session -DisableNameChecking
the progress bar comes up, it says importing and counts up to 6 or 700 commands as expected then the unexpected error message:
Import-PSSession : Data returned by the remote Get-FormatData command is not in the expected format.
After that, none of the commands work - example Get-Mailbox
#2
Connect-EXOPSSession -UserPrincipalName ******@x.com
same deal. same error
Import-PSSession : Data returned by the remote Get-FormatData command is not in the expected format.
At C:\Users\x\AppData\Local\Apps\2.0\A53V0WOT.PE1\6Y7OL9NA.H46\micr..tion_1f16bd4ec4c2bb19_0010.0000_673f37
c317fb5976\CreateExoPSSession.ps1:311 char:40
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (:) [Import-PSSession], ArgumentException
+ FullyQualifiedErrorId : ErrorMalformedDataFromRemoteCommand,Microsoft.PowerShell.Commands.ImportPSSessionCommand
#3
Connect-ExchangeOnline -UserPrincipalName ******@x.com -ShowProgress $true
same deal. same error
The module allows access to all existing remote PowerShell (V1) cmdlets in addition 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 https://aka.ms/exops-docs
Send your product improvement suggestions and feedback to ******@service.microsoft.com. For issues related to the module, contact Microsoft support. Don't use the feedback alias for problems or support issues.
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
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (:) [Import-PSSession], ArgumentException
+ FullyQualifiedErrorId : ErrorMalformedDataFromRemoteCommand,Microsoft.PowerShell.Commands.ImportPSSessionCommand
At this point effectively unable to admin exchange online via powershell. Anyone have any ideas?
Microsoft 365 features that help users manage their subscriptions, account settings, and billing information.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
UPDATE - Added "-delegatedorganization xxx.onmicrosoft.com" and now it connects to V2
As of this morning, I am experiencing this isssue as well with both the legacy Powershell and V2.
Import-PSSession : Data returned by the remote Get-FormatData command is not in the expected format.
At C:\Users\****\Documents\WindowsPowerShell\Modules\ExchangeOnlineManagement\1.0.1\ExchangeOnlineManagement.psm1:454 char:40
I was able to connect tot he legacy Exchange online powershell by doing the commandname workaround as described above. But I cannot connect to the V2 powershell.
The last time I was successfully connected was July 2nd. Something changed between now and then.
Another Immaculate Connection miracle! After a full week, it seems to be miraculously working again.
It’s really strange to me how ‘-CommandName *’ would work as a workaround.
Maybe someday we’ll get an explanation from MS.
I was having the same issue. But using Connect-EXOPSSession -UserPrincipalName ******@contoso.com -DelegatedOrganization contoso.onmicrosoft.com worked fine..
This "Connect-EXOPSSession -UserPrincipalName ******@contoso.com" was enough previously but -DelegatedOrganization with same tenant name works.
I am also having this problem and seemingly out of nowhere. I was on it from the same machine about 5 hours ago and now all of a sudden, it started happening. I will say that adding the DelegatedOrganization seems to correct the problem, it wasn't necessary earlier today. I didn't have to change the connectionuri to make it work