You get something like:
Get-MsolUser -UserPrincipalName user@domain.com | fl *status*,errors
OverallProvisioningStatus : Success
ValidationStatus : Error
Errors : {Microsoft.Online.Administration.ValidationError}
How to get more details about the "ValidationStatus" Error?
Solution:
for users:
$errors = (Get-MsolUser -UserPrincipalName "user@domain.com").Errors
for contacts:
$errors = (Get-MsolContact -ObjectID <Object_ID>).Errors
for groups:
$errors = (Get-MsolGroup -ObjectID <Object_ID>).Errors
and then expand $errors variable:
$errors | % {"`nService: "+ $_.ErrorDetail.Name.split("/")[0]; "Error Message: "+ $_.ErrorDetail.ObjectErrors.ErrorRecord.ErrorDescription}
Example:
$errors = (Get-MsolUser -UserPrincipalName user@domain.com).Errors
$errors | % {“`nService: ” + $_.ErrorDetail.Name.split("/")[0]; “Error Message: ” + $_.ErrorDetail.ObjectErrors.ErrorRecord.ErrorDescription}
Service: exchange
Error Message: Exchange can't disable the mailbox "NAMPR07A002.prod.outlook.com/Microsoft Exchange Hosted Organizations/xxxxx.onmicrosoft.com/Soft Deleted Objects/UserNameHere" because it is on In-Place Hold.