When user account management is handled by multiple admins, expiry dates may be altered due to contract renewals or project extensions. Without proper tracking, this can lead to unauthorized access, non-compliance, lack of accountability, and security gaps in Active Directory. Therefore, admins need to monitor changes in account expiry to prevent operational disruptions.
Make sure to enable the Audit User Account Management policy in the GPMC and perform the steps below.
- Open the Event viewer, then go to Windows Logs»Security.
- In the right pane, click the Filter Current Log and enter the event id as 4738 in <All Event IDs> placeholder.
- Click OK to display all user account change events with Event ID 4738. From the filtered results, choose the relevant event and review the Changed Attributes section to verify whether it includes an account expiry update.
- If the event confirms an expiry modification, inspect the Subject Account Name field to identify the user who performed the account expiry change.
Note: You must review the Security logs on all domain controllers, as account modifications are recorded only on the domain controller that processed the change.
While the above method requires manually checking each event, PowerShell efficiently tracks who changed account expiry dates by querying security logs.
Run the following PowerShell cmdlet on a domain controller to view all events where the account expiry date was changed.
Get-WinEvent -FilterHashtable @{LogName = 'Security'; ID = 4738} |
Where-Object {
$_.Message -match "Changed Attributes" -and
$_.Message -match "Account Expires" -and
$_.Message -notmatch "Account Expires:\s*-|Account Expires:\s*$"
} |
Select-Object `
TimeCreated,
@{Name = 'ChangedBy'; Expression = {
($_.Message -split "`n" | Where-Object { $_ -match "Account Name:" })[0] -replace '.*Account Name:\s*', ''
}},
@{Name = 'TargetAccount'; Expression = {
($_.Message -split "`n" | Where-Object { $_ -match "Account Name:" })[1] -replace '.*Account Name:\s*', ''
}},
@{Name = 'AccountExpires'; Expression = {
($_.Message -split "`n" | Where-Object { $_ -match "Account Expires" }) -replace '.*Account Expires:\s*', ''
}},
@{Name = 'Category'; Expression = { $_.TaskDisplayName }} |
Format-Table -Wrap -AutoSize
The output includes account expiration modifications that are recorded only on the domain controller where this command is executed. It displays details such as who made the change, the date and time of modification, targeted account, and the task category.
No more hopping between domain controllers to find out who changed accounts expiry dates!
- With AdminDroid's Updated User Events report, you can easily find who have changed the account expiration dates by just applying Updated Attribute filter to Account-Expires.
- This report includes key details such as the time of update, the user whose account was changed, who made the change, the new expiration date, and more.
- Since AdminDroid can query all the selected domain controllers, you can track AD account expiry date changes without switching between domain controllers.