$errors = (Get-MsolContact –ObjectID <Object_ID>).Errors
$errors | foreach-object {“nService: " + $_.ErrorDetail.Name.split("/")[0]; "Error Message: "+ $_.ErrorDetail.ObjectErrors.ErrorRecord.ErrorDescription}
$errors = (Get-MsolGroup –ObjectID <Object_ID>).Errors
$errors | foreach-object {"nService: ” + $_.ErrorDetail.Name.split(“/”)[0]; “Error Message: “+ $_.ErrorDetail.ObjectErrors.ErrorRecord.ErrorDescription}
$errors = (Get-MsolUser -UserPrincipalName “<User_ID>”).Errors
$errors | foreach-object {“`nService: ” + $_.ErrorDetail.Name.split(“/”)[0]; “Error Message: ” + $_.ErrorDetail.ObjectErrors.ErrorRecord.ErrorDescription}
Get-MsolUser -HasErrorsOnly -All | ft DisplayName,UserPrincipalName,@{Name=”Error”;Expression={($_.errors[0].ErrorDetail.objecterrors.errorrecord.ErrorDescription)}} -AutoSize -wrap
https://support.microsoft.com/en-au/help/2741233/you-see-validation-errors-for-users-in-the-office-365-portal-or-in-the
1 2 3 4 5 6 7 8 9 |
$output = @() $usererr = Get-MsolUser -HasErrorsOnly Foreach ($user in $usererr) { $output += New-Object psobject -Property @{ user = $user.UserPrincipalName errordetail = $user.Errors.ErrorDetail.Name.split(“/”)[0] details = $user.Errors.ErrorDetail.ObjectErrors.ErrorRecord.ErrorDescription} } $output | export-csv c:\temp\outpute.csv -NoTypeInformation |
1 2 3 4 5 6 7 8 |
function Get-MSOLUserWithValidationError { $usererr = Get-MsolUser -HasErrorsOnly Foreach ($user in $usererr) { Write-output $user.UserPrincipalName; “Service: “+ $user.Errors.ErrorDetail.Name.split(“/”)[0]; “Error Message: “+ $user.Errors.ErrorDetail.ObjectErrors.ErrorRecord.ErrorDescription +“`n” } } |
testest test