IAdmAccountOptionsCondition

The IAdmAccountOptionsCondition interface represents the If certain account options are enabled / disabled condition.

Inheritance: IAdmCondition

Properties

  • Property

  • Description

  • AccountOptionsValue

  • Gets or sets a value indicating which account options should be enabled to meet the condition.

  • AccountOptionsMask

  • Gets or sets a mask that determines which account options to check.

  • LogicalOperator

  • Gets or sets a logical operator that determines how to check account options.

Details

AccountOptionsValue

Gets or sets a value indicating which account options should be enabled to meet the condition. For a list of available account options flags, see ADS_USER_FLAG_ENUM.

  • Type:
  • int
  • Access:
  • Read/Write

Examples

The following code sample creates a condition that returns true when smart card is required for interactive logon.

PowerShell
# The $actionSet variable refers to an action set in a
# business rule, custom command, or scheduled task.

# Create condition.
$condition = $actionSet.Conditions.CreateEx("adm-AccountOptionsCondition")
$accountOptionsCondition = $condition.GetCondition()
$ADS_UF_SMARTCARD_REQUIRED = 0x40000
$accountOptionsCondition.AccountOptionsValue = $ADS_UF_SMARTCARD_REQUIRED
$accountOptionsCondition.AccountOptionsMask = $ADS_UF_SMARTCARD_REQUIRED

# Save changes.
$condition.SetCondition($accountOptionsCondition)
$condition.SetInfo()
$actionSet.Conditions.Add($condition)
C#
// The actionSet variable refers to an action set in a
// business rule, custom command, or scheduled task.

// Create condition.
IAdmBusinessRuleCondition condition =
    (IAdmBusinessRuleCondition)actionSet.Conditions.CreateEx("adm-AccountOptionsCondition");
IAdmAccountOptionsCondition accountOptionsCondition =
    (IAdmAccountOptionsCondition)condition.GetCondition();
accountOptionsCondition.AccountOptionsValue = (int)ADS_USER_FLAG_ENUM.ADS_UF_SMARTCARD_REQUIRED;
accountOptionsCondition.AccountOptionsMask = (int)ADS_USER_FLAG_ENUM.ADS_UF_SMARTCARD_REQUIRED;

// Save changes.
condition.SetCondition(accountOptionsCondition);
condition.SetInfo();
actionSet.Conditions.Add(condition);

AccountOptionsMask

Gets or sets a mask that determines which account options to check.

  • Type:
  • int
  • Access:
  • Read/Write

Examples

The following code sample creates a condition that returns true when smart card is not required for interactive logon, and the user must change password at next logon.

PowerShell
# The $actionSet variable refers to an action set in a
# business rule, custom command, or scheduled task.

# Create condition.
$condition = $actionSet.Conditions.CreateEx("adm-AccountOptionsCondition")
$accountOptionsCondition = $condition.GetCondition()

$ADS_UF_SMARTCARD_REQUIRED = 0x40000
$ADAXES_UF_MUST_CHANGE_PASSWD_AT_LOGON = 0x80000000

# Mask sets the options that the condition will check.
$accountOptionsCondition.AccountOptionsMask = 
    $ADS_UF_SMARTCARD_REQUIRED + 
    $ADAXES_UF_MUST_CHANGE_PASSWD_AT_LOGON

# Value sets the options that must be enabled to meet the condition.
$accountOptionsCondition.AccountOptionsValue = 
    $ADAXES_UF_MUST_CHANGE_PASSWD_AT_LOGON

# Save changes.
$condition.SetCondition($accountOptionsCondition)
$condition.SetInfo()
$actionSet.Conditions.Add($condition)
C#
// The actionSet variable refers to an action set in a
// business rule, custom command, or scheduled task.

// Create condition.
IAdmBusinessRuleCondition condition =
    (IAdmBusinessRuleCondition)actionSet.Conditions.CreateEx("adm-AccountOptionsCondition");
IAdmAccountOptionsCondition accountOptionsCondition =
    (IAdmAccountOptionsCondition)condition.GetCondition();

// Mask sets the options that the condition will check.
accountOptionsCondition.AccountOptionsMask = 
    (int)ADS_USER_FLAG_ENUM.ADS_UF_SMARTCARD_REQUIRED + 
    (int)ADS_USER_FLAG_ENUM.ADAXES_UF_MUST_CHANGE_PASSWD_AT_LOGON;

// Value sets the options that must be enabled to meet the condition.
accountOptionsCondition.AccountOptionsValue = 
    (int)ADS_USER_FLAG_ENUM.ADAXES_UF_MUST_CHANGE_PASSWD_AT_LOGON;

// Save changes.
condition.SetCondition(accountOptionsCondition);
condition.SetInfo();
actionSet.Conditions.Add(condition);

LogicalOperator

Gets or sets a logical operator that determines how to check account options.


Requirements

Minimum required version: 2012.1

See also