Enable - Inactive Disabled AD Users - X Days
Summary
This script enables the inactive users that are not logged in for over X days (configurable via the system property Inactive_AD_Users_Threshold_Days; default: 90 days).
This script excludes the default account Administrator|Guest|krbtgt|DefaultAccount|.*\$. Here, *\$ meant any user that has $ in its name end.
For e.g. Computername$, UserName$
Sample Run
-
If set to
All, all inactive disabled users exceeding theThreshold_Dayswill be enabled
-
If it is set to some specific user's name, e.g.,
Demo,Test,TestUser, then it will enable only the provided users.

-
If it is left
blank, then it will enable all the disabled users that are disabled via Script - Disable - Inactive AD Users - X Days

File Hash
| Path | Algorithm | Hash |
|---|---|---|
C:\ProgramData\_automation\script\Inactive_ADUsers\Activate_DisabledADUser.ps1 | MD5 | ED097C469DCFC26A806A252CD2696B79 |
C:\ProgramData\_automation\script\Inactive_ADUsers\Activate_DisabledADUser.ps1 | SHA256 | 921D08FCA45D5C4F4F61100F3B047F6470B5CBFDC0E301255B77866E8B04F2E8 |
Dependencies
Solution- Inactive AD Users Disable/Enable
User Parameters
| Name | Example | Required | Description |
|---|---|---|---|
UserList | test,demo,testuser | False | To run with autofix using the internal monitor, UserList does not need to be set. If the script runs on demand, then if: (i) UserList = All → Enables all inactive, disabled users exceeding Threshold_Days. (ii) UserList = Demo,Test,TestUser → Enables only the specified users. (iii) UserList left blank → Enables all disabled users that were disabled via Script - Disable - Inactive AD Users - X Days and user list provided in the exclusion EDF. |
System Property
| Name | Level | Required | Description |
|---|---|---|---|
| Inactive_AD_Users_Threshold_Days | 90 | True | This is set to detect the inactive users those are not logged in from the provided days. Default is 90 days. ![]() |
| Inactive_AD_Users_Exclude_Disable | demo,test,testuser | False | This will exclude the users from being included in the list to get disabled. In this case, the users provided in this EDF will get enabled if they are disabled. The users list should be provided in a comma-separated format. e.g., John,Kevin,demo. ![]() |

