Mailboxes can me marked as invalid in Exchange; this usually doesn’t affect the day-to-day function of the mailbox (usually) but it will prevent any changes happening to the object (using the standard Exchange tools). However, whatever is causing those mailboxes to be marked as invalid might cause problems for other systems that use that directory (such as Office 365 or a meta-directory connected system).
To find all the mailboxes which are marked as invalid you can use the following command from an Exchange PowerShell Window;
Get-Mailbox | Where-Object {!$_.IsValid}
You can use the filter on Get-Mailbox to get a subset of data like;
Get-Mailbox -Filter {Office-Like "HQ"} | Where-Object {!$_.IsValid}
Once you’ve got a list invalid mailboxes you can remediate them