AD - Password Expiration Notification
Overview
For every enabled user whose password expires within N days (default 7) the script:
- Emails the user (AD 'mail' attribute) through Microsoft Graph or SMTP.
- If the user has no email address, emails an optional helpdesk / PSA address instead (replaces the Automate "Create New Ticket" branch), otherwise records it as an issue.
- Writes an HTML table (one row per user) to a WYSIWYG custom field and an issue count to an Integer custom field, so a NinjaOne Custom Field condition can raise an alert or ticket.
Requirements
- Windows Server with Roles
Infrastructure Master - Run As:
System - PowerShell 5.1
Sample Run
- Navigate to Automation -> Script:

- Search for the script
AD - Password Expiration Notificationand click on it.

- To run the script without setting the custom field cPVAL AD Password Expiry Email Method Email method (Graph or SMTP), toggle the
ReportOnlyoption, this will run the script and update the custom field cPVAL AD Password Expiry Report so that the knowledge article can be populated.

- Once the Email method is set in the custom field cPVAL AD Password Expiry Email Method either (Graph or SMTP), run the script directly without setting the script variable parameter to report the password expiration via email to the AD user whose password is about to expire within the threshold or the helpdesk user if the AD user email doesn't exist.

- Click on Run again

Custom Fields
| Custom Field | Scope | Type | Description |
|---|---|---|---|
| Custom Field: cPVAL AD Password Expiry Report | Device | WYSIWYG | This custom field stores the last-run summary, expiring user list, including their status in the html data (tabular format). |
Dependencies
- Custom Field: cPVAL AD Password Expiry Email Method
- Custom Field: cPVAL AD Password Expiry Report
- Audit Report: AD Password Expiration Notification
- Solution - AD Password Expiration Notification
Automation Setup/Import
Output
- Activity Details
- Custom Field: Custom Field: cPVAL AD Password Expiry Report
Changelog
2026-11-09
- Initial version of the document