Office 365: Identify the accounts blocked with PowerShell [Quick Guide]

3:43 pm January 23, 201713438

I. introduction

logo-office-365-80 either for reporting, to identify accounts blocked or simply to try to identify the cause of an account that does not work, you may need to know whether or not an account is blocked in Office 365, PowerShell via all . When a blocked account occurs, the user for the following message to the connection: “ it seems that your account for been blocked.” Please contact your administrator to unlock.

as usual, you first need to initiate the connection to the service O365: tutorial O365 in PowerShell connection

II. Procedure

when we list users with Get-MsolUser, there is a named attribute ‘ BlockCredential ‘ which allows to know if the account is blocked or not, if it is equal to true the account is blocked, on the other hand if it’s false account is allowed.

Simply to list the accounts blocked in a table with the address e-mail followed by the value of BlockCredential (in this example this allows to verify that the result is coherent):

 Get-MsolUser - All | Where {$_.} BlockCredential - eq $true} | FT UserPrincipalName, BlockCredential 

you will get a return of this type:

 UserPrincipalName BlockCredential [email protected] True [email protected] True 

to unlock (re-enable) all accounts blocked a single command, it relies on Get-MsolUser to select the blocked users and you change the value of BlockCredential for these users via the Set-MsolUser commandlet:

 Get-MsolUser - All | Where {$_.} BlockCredential - eq $true} | Set-MsolUser - UserPrincipalName $_. UserPrincipalName - BlockCredential $False 

Finally, if you want to unblock a specific account:

 Get-MsolUser - UserPrincipalName "[email protected]" | Set-MsolUser - UserPrincipalName $_. UserPrincipalName - BlockCredential $False 

this tutorial is over, I want to clarify that the blocking or unblocking an account maybe made from a browser in the administration Office 365 Center.