Skip to main content

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 the Threshold_Days will be enabled Sample Run

  • If it is set to some specific user's name, e.g., Demo,Test,TestUser, then it will enable only the provided users.
    Sample Run

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

File Hash

PathAlgorithmHash
C:\ProgramData\_automation\script\Inactive_ADUsers\Activate_DisabledADUser.ps1MD5ED097C469DCFC26A806A252CD2696B79
C:\ProgramData\_automation\script\Inactive_ADUsers\Activate_DisabledADUser.ps1SHA256921D08FCA45D5C4F4F61100F3B047F6470B5CBFDC0E301255B77866E8B04F2E8

Dependencies

Solution- Inactive AD Users Disable/Enable

User Parameters

NameExampleRequiredDescription
UserListtest,demo,testuserFalseTo 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

NameLevelRequiredDescription
Inactive_AD_Users_Threshold_Days90TrueThis is set to detect the inactive users those are not logged in from the provided days. Default is 90 days. Property
Inactive_AD_Users_Exclude_Disabledemo,test,testuserFalseThis 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. Property

Output