Skip to main content

AD - Password Expiration Notification

Overview​

For every enabled user whose password expires within N days (default 7) the script:

  1. Emails the user (AD 'mail' attribute) through Microsoft Graph or SMTP.
  2. 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.
  3. 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:

Sample Screenshot

  • Search for the script AD - Password Expiration Notification and click on it.

Sample Screenshot 1

Sample Screenshot 2

  • 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.

Sample Screenshot 3

  • Click on Run again

Sample Screenshot 4

Custom Fields​

Custom FieldScopeTypeDescription
Custom Field: cPVAL AD Password Expiry ReportDeviceWYSIWYGThis custom field stores the last-run summary, expiring user list, including their status in the html data (tabular format).

Dependencies​

Automation Setup/Import​

Automation Configuration

Output​

Changelog​

2026-11-09​

  • Initial version of the document