How can I determine which users have the "Password never expires" flag set on their account?

John Savill

October 30, 2005

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. You can use the following script, which you can download at http://www.windowsitpro.com/content/content/48309/nopwdexpiry.zip to query the userAccountControl attribute of each user to check whether the account is flagged with "Password never expires" setting. Note that some lines wrap because of space limitations:

'listnopwdexpiry.vbs' John Savill 20 October 2005Option ExplicitDim strLdapPath, objConnection, objChild, userFlagConst ADS_UF_DONT_EXPIRE_PASSWD = &H10000' Check whether all required arguments have been passed.If Wscript.Arguments.Count Pass the script to the path to the user's container that you want to check by using the following command: 
D:Temp>cscript listnopwdexpiry.vbs cn=users,dc=savilltech,dc=com

which displays the following output:  
Microsoft (R) Windows Script Host Version 5.6Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.CN=AdministratorCN=Clark KentCN=Emmaline SavillCN=GuestCN=IUSR_SAVDALDC01CN=IWAM_SAVDALDC01CN=John SavillCN=SUPPORT_388945a0Operation Completed

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like