cannot connect to exchange online via powershell

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 *** Email address is removed for privacy ***


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

+ ...      $PSSessionModuleInfo = Import-PSSession $PSSession -AllowClobber

+                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidResult: (:) [Import-PSSession], ArgumentException

    + FullyQualifiedErrorId : ErrorMalformedDataFromRemoteCommand,Microsoft.PowerShell.Commands.ImportPSSessionCommand


#3

Connect-ExchangeOnline -UserPrincipalName *** Email address is removed for privacy *** -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 *** Email address is removed for privacy ***. 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

+ ... oduleInfo = Import-PSSession $PSSession -AllowClobber -DisableNameChe ...

+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + 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?

* Please try a lower page number.

* Please enter only numbers.

* Please try a lower page number.

* Please enter only numbers.

Good to know...I guess Microsoft is playing with things again...hahah

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi folks,

a quick update from engineering:

This is a known issue with only some of the service endpoints, which is why some of you are affected, some not, and why it can go away after some time.

Engineering is working on a fix for this and will patch this as soon as possible (Since we are still narrowing it down, I can't give you a solid ETA yet, sorry), at which point everything should be back to normal. Once the problem has been resolved, I will most definitely post an update here.

In the meantime, there is a workaround to get you unblocked:

You can update the connection Uri to explicitly include the "SerializationLevel=Full" parameter.

For example:

Connect-ExchangeOnline

would become:

Connect-ExchangeOnline -ConnectionUri "https://outlook.office365.com/powershell-liveid?SerializationLevel=Full"

While this will keep working indefinitely, it increases the bandwidth use, potentially slowing execution at scale. I would recommend to not use this as a permanent update to your code and undo it once the issue has been resolved.

Note: We have received reports of this workaround not working for everybody and were able to reproduce the issue.

If the workaround above fails to work for you, there is another workaround option that will fully redirect you to another server:

Connect-ExchangeOnline -DelegatedOrganization TENANT.onmicrosoft.com

This is a less ideal solution, as it affects the target server selection, preventing our session performance optimization to fully apply, so only use this if option one fails you.

I'll try to keep you updated on this once I have any news on the issue :)

If you are affected by this and want to help us troubleshoot this, please fill out this quick survey. It helps us with developing a pattern and tracking down affected sessions.

Update: Fixed error in workaround

2 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Workaround also not working

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Thanks to everyone for this incredible thread! I am also experiencing the exact same issue on all 3 of my runbooks that were running flawlessly the past 4 days, and now continue to throw back the error: Data returned by the remote Get-FormatData command is not in the expected format. (Data returned by the remote Get-FormatData command is not in the expected format.) 

I did update the connection URI to include the "SerializationData=Full" but it throws the same error. I will go ahead and fill in the survey as well. This is affecting our organization at a massive scale, so I hope this is resolved quickly.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

I am experiencing this issue as well as of 830 AM EST this morning. No one else on my team has this issue though so its quite frustrating. Tried the work around. Filled out the survey as well

Thanks

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Everbody,

just a quick response to the recent posts:

I don't have a sudden solution to even the workaround not working for you, unfortunately, but I want to make sure you know, we got the message and I have informed the engineering team working on this!

I am going to publish an update as soon as we have anything useful. As mentioned, hunting down an intermittent issue is a real pain, filling out the survey really helps (and keeps helping) our team to work on this, so "thank you" to all who have submitted that info!

Cheers,

Friedrich

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

I would feel better if others on my team were having this issue, but it seems to be just me, so very strange.

Thanks for being in contact and providing updates

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hello all

Thanks to everyone for your input on this issue. For my part, I have not got the error since I first participated in this thread. I haven't change anything and the authentication just goes trough as it did for the last 4 years! Odd enough and scarry at the same time....

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

I'm getting the same error.  In reading through this thread it seems that individuals using cloud only accounts for this connection may be having this issue.  I've tried all the workarounds while still using my cloud only account and none of them work.  If I use a synced account everything appears to be OK.   This is quite problematic as all my nightly process run using our cloud only account so things we do like locking accounts for termination, reclaiming licenses and the like have all started to fail.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Agreed Sandi! I actually have an executive meeting this afternoon to discuss this and how we are going to "semi-automate" a solution until the issue has been resolved. I am hopeful but we need a definitive solution vs a workaround. Just my .2 cents.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

* Please try a lower page number.

* Please enter only numbers.

* Please try a lower page number.

* Please enter only numbers.

 
 

Question Info


Last updated December 20, 2020 Views 6,164 Applies to: