Hello,
The Unlock User Home Page Action allows you to unlock multiple user accounts simultaneously if you've enabled the Allow multiple selection option. For more details, see Step 3 in section Enable/Disable/Unlock Account of the following tutorial: http://www.adaxes.com/tutorials_WebInte ... ableenable. However, the Select all objects on all pages is not available for this Action. In Adaxes 2015.1, we'll change the look and feel of Adaxes Web Interface. As a part of it, we'll make it easier to execute actions on multiple objects.
For now, you can use the following script to unlock all locked accounts:
# Find all locked user accounts
$searcher = $Context.BindToObject("Adaxes://rootDSE")
$searcher.PageSize = 500
$searcher.SearchScope = "ADS_SCOPE_SUBTREE"
$searcher.SearchFilter = "(&(sAMAccountType=805306368)(lockoutTime=*))"
$searcher.ReferralChasing = "ADS_CHASE_REFERRALS_NEVER"
$searcher.SetPropertiesToLoad(@("msDS-User-Account-Control-Computed"))
$searcher.VirtualRoot = $True
$searcherResult = $searcher.ExecuteSearch()
$users = $searcherResult.FetchAll()
$searcherResult.Dispose()
$ADS_UF_LOCKOUT = [Softerra.Adaxes.Interop.Adsi.PersistentObjects.ADS_USER_FLAG_ENUM]::ADS_UF_LOCKOUT
foreach ($userId in $users)
{
$msDsUserAccountControlValue = $userId.Properties["msDS-User-Account-Control-Computed"].Value
if ($msDsUserAccountControlValue -eq $NULL)
{
continue
}
if ($msDsUserAccountControlValue -band $ADS_UF_LOCKOUT)
{
# Unlock account
$user = $Context.BindToObject($userId.AdsPath)
$user.IsAccountLocked = $False
$user.SetInfo()
}
}
You can use the script with Business Rules, Scheduled Tasks or Custom Commands. For example, you can create a Custom Command that allows to unlock all accounts upon request. To create such a Custom Command:
- Create a new Custom Command.
- On the 3rd step of the Create Custom Command wizard, select the Show all object types option.
- Select the Domain-DNS object type.
- On the 4th step of the wizard, add the Run a program or PowerShell script action and paste the above script in the Script field.
- Add a short description for the script and click OK.
- Finish creation of the Custom Command.
Now, you can run the Custom Command on any of your AD domains to unlock all locked users in all domains managed by Adaxes.
You can also create a Home Page Action for Adaxes Web interface to be able to unlock all accounts right from the Home Page. For information on how to launch a Custom Command as a Home Page Action, see section Custom Command in the following tutorial: http://www.adaxes.com/tutorials_WebInte ... #executecc. On step 3 of the section, you will find information on how to configure the action to be always executed on a specific domain. Since it doesn't really matter, on which domain the script will be executed, you can enable this option and specify any of your domains for the Web Interface to skip the domain selection step when executing the action.