Active Directory · PowerShell

powershell & Active Directory: Find all users who have “Password Never Expires” enabled using Powershell.

Hi,

In domain controller environment we all have some password policies set. In some organizations the users password is expired in 60 days in some 90 or in 180 Days.

User’s password must expired in the defined period, changing password often is a good security policy.

But when we create a user account some time by mistakes we select  “Password Never Expires”.

if  the “Password never expires” checked users password never expired.

07-08-2012 13-28-44

which is not good for user’s account security.

My todays task is to find all users , who have “Password Never Expire” checked. To archive this task we are going to use “Active Directory” module and “Get-Aduser” cmdlet with Filters Smile

Get-ADUser -Filter  'PasswordNeverExpires -eq $true'  -Server localDC | select name

 07-08-2012 13-29-42

After Get-ADuser cmdlet we are using –Filter to show all those account whose “Password Never Expires value is equal to True” which means enabled,and in –server parameter i am defining my domain controller, and  we are piping the output to “Select-Object” cmdlet and selecting to show “Name” property of the output to show.

and the output is below Smile 

07-08-2012 13-29-20

Now I can show that list to my manager so that we can fix them later Smile ..

Thanks for reading.

Aman Dhally

One thought on “powershell & Active Directory: Find all users who have “Password Never Expires” enabled using Powershell.

  1. Hi, Great idea and I would love to use this however it seems the first image is missing.
    Would be great to be able to copy the code as well as second image seems fuzzy at the server name area. Is it -Server xxxx : or -Server xxxx |

    Cheers

Comments are closed.