Office 365 - Get-User WARNING, at least one source array could not be cast down to the destination array

Been one of those Monday Mornings today.  That being said, about 7-10 days ago there was a lot of tickets being added to the help desk regarding E-mail signatures not being updated. Being there were multiple reports, I took note to keep an eye on the issue.  The support team reached out to "Exclaimer" (which I'm not entirely sure I would use again for the record, check out Crosswares) and they said they are getting a lot of reports of an "aggregation failing" and the changes in looks up not functioning. After 72 hours the help desk was calling, and e-mailing daily for updates to the equivalent of a "all circuits are busy message".   Then finally 10 Days in the following message arrives:

We have identified the error you are seeing in aggregation, and it is caused by a corrupted object in your Office 365 environment. We are currently creating a PowerShell script which will highlight the object(s) which have corruption, which will allow you to identify the cause of this error. This could be a mailbox or group in Office 365, and is likely to be something that has been added or changed recently. Once we have the script I will send this over to you, it should be ready early this week.

Once you have been able to identify the corrupt object, you will need to remove and recreate it in Office 365.

You can verify that this is the case by running the following scripts in PowerShell. The first connects to Office 365, please use an admin login when prompted. The 2nd simply tries to pull the usernames. If you see the same error when running this script, it will confirm that the issue is with a corrupt object:

Import-PSSession (New-PSSession -ConfigurationName Microsoft.Exchange -Credential $null -ConnectionURI https://ps.outlook.com/powershell -Authentication Basic -AllowRedirection) -AllowClobber

Get-User You may be able to identify the problem account by using:

Get-User “”

This will fail for the corrupt object(s). Our script will check each object.

If you do have any further questions or queries, please let me know. I will be happy to help.

First off, those of us who use powershell notice an issue with the command that they sent over.  It will error when you attempt to run the command:

None the less, that was an easy adjustment to get connected to Office 365 and Exchange online.  Once connected I went ahead and ran the "Get-User" command they suggested.  This is when it returned the following error:

WARNING: An unexpected error has occurred and a Watson Dump is being generated: At least one element in the source array could not be cast down to the detestation array type.

Trying to narrow down which User or Object it was could be difficult, especially depending on the size of your environment.  In this case I just started running a Get-User Command limiting the the result size till I had a respectable window.

Get-User -ResultSize 200

After a few attempts I was able to narrow it down to User #60 in  my environment.  In this case I did the Get-User -ResultSize 59 and saw who the last user was because I noticed by default Get-User was in Alphabetical order. Once I realized I was in the "I" users I get did a:

Get-User -Filter {name -like 'I*'}

This gave me a list of the I Users and I noticed that the user that was #60 happen to be the account created when you create a new group in Outlook Web Access to have a shared team.  Given this was a test function currently, I removed the group via the Office 365 admin interface.   At this point I was able to run the Get-User command with out errors and the Exclaimer aggregation now worked solving the issue.

My frustration issues here stem from a few things; the first being Exclaimer.  As a SaaS provider your response time to find an issue like this needs to be quicker.  Had I known how you were accomplishing your product I could have found that in about 10 seconds, not 10 days.  Secondly is why is it failing with the new groups?  According to google there are a lot of people using the Get-User command and seeing this error.  Does this then mean there is an issue with this feature and a bug report should be placed?  The thing that leads me to that path is the fact my Get-User -Filter command actually returned the supposed "problem user" but it wouldn't return on the Get-User.