Find Users With Password Never Expires in Active Directory Using PowerShell

How to Get Users With Password Never Expires in Active Directory Using PowerShell

Powershell is a powerful tool that can be used to analyze and export data for multiple tasks in Active Directory. Today, We will find how we can export the list of users who have password never expire attribute set to True. When this attribute is set to True then the Password group policy doesn’t apply to the User and it is considered an exception. So we can say if we have a Password expiry GPO on the domain level that will be applied to all users unless a user has Password never expire is checked in the Account tab of the User’s properties.
Password Never Expires

Now, Let’s see how we can get the list of Users with never expiring passwords.
Step1- Open Active Directory Module for Windows PowerShell
Step 2-  Copy the following command and press enter. it will create a file with the user’s details in the C:\temp directory.

Get-aduser -filter * -properties Name, PasswordNeverExpires | where {$_.passwordNeverExpires -eq “true” } | Select-Object DistinguishedName,Name,Enabled | Export-csv c:\temp\Aduser_never_expires.csv -NoTypeInformation

PowerShell for Never Expire AD Users

Step 3- You can open the file using Microsoft Excel and find all the details which include User’s location, name, and status in Active Directory

CSV Never Expire Password

 

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More