Skip to main content

AD Password Expiration Notification

Purpose​

How it works​

  1. The scheduled automation runs on every DC in the policy. Only the DC that holds the PDC Emulator role does the work. Other DCs clear their output fields and exit successfully, so each domain is processed once.
  2. It reads every enabled user and gets the expiry date from msDS-UserPasswordExpiryTimeComputed.
  3. For each user expiring within the window that isn't excluded:
    • Has an email address: the user gets the email.
    • No email address: the HelpDesk address gets an email (if one is set). Otherwise the user is counted as an issue.
  4. It writes a report to cpvalAdPasswordExpiryReport and a count of problems to cpvalAdPasswordExpiryIssues. A condition alerts when the count is above 0.
  5. A local state file (%ProgramData%\_Automation\Script\AD-PasswordExpirationNotification\NotificationState.json) remembers who was emailed. Each user gets one email per password cycle, as the Automate monitor did. Optional extra reminders can be set with cpvalAdPasswordExpiryReminderDays, e.g. 3,1.

Platform: NinjaOne

Key Capabilities​

  • Email User – This automation helps to email AD users whose password is about to expire.

Associated Content​

Script​

NamePurpose
AD - Password Expiration NotificationFor every enabled user whose password expires within N days (default 7) the script will send email to them. It should be scheduled daily at 6 AM to the target group Is Primary Domain Controller (Built-in group).

Custom Fields​

NameLevelTypePurpose
cPVAL AD Password Expiry DaysOrganization, Location, DeviceIntegerThis custom field is set to determine the Notification window in days.
cPVAL AD Password Expiry Email MethodOrganization, Location, DeviceDrop-downThis custom field is set to register the email method for users whose passwords are about to expire within a specified number of days.
cPVAL AD Password Expiry ExclusionsOrganization, Location, DeviceMulti-lineProvide sAMAccountNames separated by commas or newlines to be excluded from the password expiration notification. * wildcard allowed, e.g., svc_*.
cPVAL AD Password Expiry NotificationOrganization, Location, DeviceDrop-DownThis custom field is required to be set to enable the AD Password Expiry Notification alerting.
cPVAL AD Password Expiry Reminder DaysOrganization, Location, DeviceTextOptional extra reminders, e.g. 3,1. Blank means one email per cycle.
cPVAL AD Password Expiry Fallback EmailOrganization, Location, DeviceTextOptional. Helpdesk/PSA mailbox(es) for users without an email address, separated by semicolons (;).
cPVAL AD Password Expiry Graph Client SecretOrganization, Location, DeviceSecureThis is used in the Graph only. Secure fields are readable by automations only, up to 500 characters.
cPVAL AD Password Expiry Graph Client IDOrganization, Location, DeviceTextThis custom field is required to set the ClientId for the Ninja organization in O365 so the Graph integration can send emails to AD users.
cPVAL AD Password Expiry SenderOrganization, Location, DeviceTextRequired. Sending mailbox. SMTP also accepts IT Support email.
cPVAL AD Password Expiry Graph Tenant IDOrganization, Location, DeviceTextThis custom field is required to be set with the O365 tenant ID when the Graph option is set in the custom field 'cpvalAdPasswordExpiryEmailMethod'.
cPVAL AD Password Expiry SMTP PasswordOrganization, Location, DeviceSecureThis custom field is required to pass the SMTP password for the SMTP emailing method.
cPVAL AD Password Expiry SMTP PortOrganization, Location, DeviceTextThis custom field is required to be set only when the custom field 'cpvalAdPasswordExpiryEmailMethod' is set to the SMTP option. STARTTLS. Port 465 (implicit TLS) is not supported.
cPVAL AD Password Expiry SMTP ServerOrganization, Location, DeviceTextThis custom field is required to be set only when the custom field 'cpvalAdPasswordExpiryEmailMethod' is set to the SMTP option. STARTTLS. Port 465 (implicit TLS) is not supported.
cPVAL AD Password Expiry SMTP UsernameOrganization, Location, DeviceTextThis custom field is required to provide the SMTP server details only when the custom field 'cpvalAdPasswordExpiryEmailMethod' is set to the SMTP option.
cPVAL AD Password Expiry IssuesDeviceIntegerUsers who couldn't be notified + failed emails + script errors. 0 = healthy.
cPVAL AD Password Expiry ReportDeviceWYSIWYGThis custom field stores the last-run summary, expiring user list, including their status in the html data (tabular format).

Group​

NameTypePurpose
Is Primary Domain ControllerBuilt-in groupThis contains the Primary Domain Controller Windows server.

Task​

NameTypePurpose
AD Password Expiration NotificationTaskThis task is scheduled to run on the Windows Server Domain Controller (specifically to DC with Infrastructure role) to perform the AD user expiration alerting.

Audit Report​

NameTypePurpose
AD Password Expiration NotificationKnowledge ArticleThis knowledge article shows the AD users information about the user password expiry and the email sent to them or not.

Condition​

NameCondition TypePurpose
AD Password Expiration NotificationCustom field ConditionThis condition is built to create ticket if the AD user password expiration email sent failed.

Implementation​

Step 1: Create the Custom Fields​

Create the below custom fields:

Step 2: Create the Automation​

Create the automation and set it to run as System.

Step 3: Create the Task​

Step 4: Create the Condition​

Create the condition and add it to the Windows Server Policy

Step 5: Action​

FAQ​

Q: Can this automation will be set without setting the Email method?

Yes, just check the ReportOnly method in the Script - AD - Password Expiration Notification variable.

Changelog​

2026-11-11​

  • Initial version of the document