Script repository

Check whether the Password never expires account option is updated

Updated on: Jan 18, 2026, Views: 1963

Property validation

The script returns $true if the Password never expires account option is being updated for the user. To execute the script, use the If PowerShell script returns true condition in a business rule triggering Before updating a user.

if (-not($Context.IsPropertyModified("userAccountControl")))
{
    return
}

$itemMask = $Context.Action.PropertyList.GetPropertyItemMask("userAccountControl")
$Context.ConditionIsMet = $itemMask -band [Softerra.Adaxes.Interop.Adsi.PersistentObjects.ADS_USER_FLAG_ENUM]::ADS_UF_DONT_EXPIRE_PASSWD

Comments 0

You must be signed in to comment.

    Got questions?

    Support Questions & Answers

    We use cookies to improve your experience.
    By your continued use of this site you accept such use.
    For more details please see our privacy policy and cookies policy.