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.
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)