Script Repository


Check whether Microsoft 365 user account is blocked

April 28, 2020
1536

The script can be used in Business Rules, Custom Commands and Scheduled Tasks to check whether a user is blocked from signing in to Microsoft 365 (Office 365). To use it with Adaxes, add the script to your rule, command or task using the If PowerShell script returns true condition.

Edit Remove
PowerShell
$Context.ConditionIsMet = $False

try
{
    $signInBlocked = $Context.TargetObject.Get("adm-O365AccountBlocked")
}
catch
{
    return # The user doesn't have a Microsoft 365 account
}

$Context.ConditionIsMet = !($signInBlocked)

Comments ( 0 )
No results found.
Leave a comment