Set The Password Never Expires Attribute - ManageEngine

Related features:

  • Self-service password reset
  • Self-service account unlock
  • Active Directory MFA
  • Active Directory password change
  • Windows logon MFA

Related Powershell Guides:

  • Enterprise self-service
    • PowerShell script to reset user's password in Google Apps
    • How to reset an Entra ID user password using PowerShell
    • How to automate password reset with PowerShell command
    • How to automate password reset with PowerShell command
    • Office 365 Password Policy with PowerShell
    • How to change local user password remotely using PowerShell script
    • How to unlock Active Directory user account using PowerShell script
    • How to change user password at first logon using PowerShell script
    • How to change Entra ID user password with PowerShell
  • Password management
    • How to get password age with PowerShell
    • How to secure Active Directory passwords using PowerShell
    • How to audit Active Directory password quality using PowerShell
    • How to find bad password attempts in Active Directory using PowerShell
    • How to blacklist weak Active Directory passwords
    • How to identify Active Directory Users with Pwned Passwords using PowerShell?
  • Password expiry notifier
    • How to change password never expires attribute and set a password expiration date using PowerShell
    • Password Expiry Email Notification using PowerShell
    • Account Expiry Notification using PowerShell Script
  • Password sync
    • How to sync Active Directory password with Microsoft 365 using PowerShell
    • How to sync password between Active Directory domains using PowerShell
  • Password policy enforcer
    • How to get fine-grained password policy using PowerShell
    • How to enforce password policy in Active Directory using PowerShell
  • Home
  • PowerShell
  • Changing the Password never expires attribute and expiration date using PowerShell
Changing the Password never expires attribute and expiration date using PowerShell

Step 1: Check if a user’s password is set to "never expire"

Run the following command to check the PasswordNeverExpires attribute.

Copy Get-ADUser -Identity "username" -Properties "PasswordNeverExpires"

Note: This returns True if the password never expires, False otherwise.

Step 2: Disable the Password Never Expire setting

To enforce password expiry for a user, set PasswordNeverExpires to $false. This will require the user to change their password periodically.

Copy Set-ADUser -Identity "username" -PasswordNeverExpires $false

Step 3: Set a custom password expiration date

Modify the expiration date for a specific user. This forces the password to expire in 30 days.

Copy Set-ADUser -Identity "username" -Replace @{"msDS-UserPasswordExpiryTimeComputed" = [datetime]::Now.AddDays(30)}

Step 4: Apply these settings to an entire group

Update all users in a specific group using the command below. This loops through all users in the group and applies the change.

Copy Get-ADGroupMember -Identity "GroupName" | ForEach-Object {Set-ADUser -Identity $_.SamAccountName -PasswordNeverExpires $false}

FAQs

1. How do I set a user’s password to "never expire"?

Run the following PowerShell command by replacing username with the actual user’s username.

Copy Set-ADUser -Identity username -PasswordNeverExpires $true

2. How can I reset a user’s password expiry date?

The command below will force the user to reset their password at the next login.

Copy Set-ADUser -Identity username -Replace @{pwdLastSet=0}

3. How do I check if a user’s password is set to "never expire"?

Check if a user’s password is set to "never expire" by running the command below. This will return True if the password never expires.

Copy Get-ADUser -Identity username -Properties PasswordNeverExpires | Select Name, PasswordNeverExpires
  • Step 1: Check if a user’s password is set to "never expire"
  • Step 2: Disable the Password Never Expire setting
  • Step 3: Set a custom password expiration date
  • Step 4: Apply these settings to an entire group
  • FAQs

ADSelfService Plus trusted by

Toshiba IBM CHSi Symantec Alcatel Lucent Northrop Grumman L & T Infotech Cisco Ebay A single pane of glass for complete self service password management Password Self-ServiceDirectory Self-ServiceOne IdentitySecurityRelated Products
  • Self-service password reset
  • Self-service account unlock
  • Web-based domain password change
  • Password expiration notifications
  • Password synchronization
  • Password policy enforcer
  • Cached credentials update
  • Reporting and auditing
  • Password self-service from logon screens
  • Mobile password management
  • Password security and compliance
  • Active Directory password audit
  • Active Directory MFA
  • Conditional access
  • Passwordless authentication
  • Two-factor authentication
  • Endpoint MFA
  • MFA for remote and local Windows logons
  • MFA for remote and local macOS and Linux logons
  • MFA for VPN and OWA logons
  • FIDO2 MFA
  • MFA for UAC
  • Offline MFA
  • Device-based MFA
  • SAML SSO
  • OAuth and OIDC SSO
  • MFA for cloud apps
  • Passwordless authentication
  • Just-in-time provisioning
  • SIEM integration
  • ITSM integration
  • IAM integration
  • Self-service group management
  • Directory self-update
  • Employee search
  • Organization chart
  • Approval-based workflow for self-service
  • Post-action notifications
  • Security and its importance
  • Endpoint security
  • Active Directory Management & Reporting
  • Exchange Server Auditing & Reporting
  • Active Directory Backup & Recovery Tool
  • Active Directory FREE Tools
  • All Windows AD Tools
  • Active Directory Auditing
  • File server auditing & data discovery
  • SharePoint Management and Auditing Solution
  • Integrated Identity & Access Management (AD360)
  • Real-time Log Analysis and Reporting Solution
  • Microsoft 365 Management & Reporting Tool
  • Cloud Security & Log Management
  • Comprehensive threat mitigation & SIEM (Log360)
  • Download
  • Live Demo
  • Compare Editions
  • Free Edition
  • Get Quote
  • Buy Now

A single pane of glass for complete self service password management

Free Trial Get Quote Email Download Link

Tag » Active Directory Pwdlastset Reset