Disable - Inactive AD Users - X Days
Summary
This script detects the inactive users over X days (configurable via the system property Inactive_AD_Users_Threshold_Days; default: 90 days) to disable them, and records the data into the Table - pvl_ad_inactive_users so that it can be represented in the Dataview - Inactive AD Users Audit.
This script excludes the default account Administrator|Guest|krbtgt|DefaultAccount|.*\$.
Here, *\$ meant any user that has $ its name at the end.
For e.g. Computername$ UserName$
Sample Run
Run normally to disable inactive AD users over threshold
File Hash
| Path | Algorithm | Hash |
|---|---|---|
C:\ProgramData\_automation\script\Inactive_ADUsers\Inactive_ADUser.ps1 | MD5 | A800A3A4D67F6FCD40AC2A82BE22BAC6 |
C:\ProgramData\_automation\script\Inactive_ADUsers\Inactive_ADUser.ps1 | SHA256 | 6CB55D8370C4F78826C2893CD30472EC180A19FE4DBF0886C3AD5C3190E98EC2 |
Dependencies
Solution- Inactive AD Users Disable/Enable
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. The user's list should be provided in a comma-separated format. e.g., John,Kevin,demo. ![]() |
Process
-
If the property
Inactive_AD_Users_Exclude_Disableis provided and the Client EDFExclude AD Inactive UserListis set with the users, then script will exclude the users list from propertyInactive_AD_Users_Exclude_Disable+Exclude AD Inactive UserListClient EDF list. -
If the property
Inactive_AD_Users_Exclude_Disableis empty and the Client EDFExclude AD Inactive UserListis set, then the Client EDFExclude AD Inactive UserListlist of users will be excluded. -
If property
Inactive_AD_Users_Exclude_Disablehas user lists and the EDFs at client levelExclude AD Inactive UserListis empty, then the scriptInactive_AD_Users_Exclude_Disablewill be accepted for the exclusion.

