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