Skip navigation

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

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 2005

Option Explicit

Dim strLdapPath, objConnection, objChild, userFlag
Const 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.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

CN=Administrator
CN=Clark Kent
CN=Emmaline Savill
CN=Guest
CN=IUSR_SAVDALDC01
CN=IWAM_SAVDALDC01
CN=John Savill
CN=SUPPORT_388945a0
Operation Completed
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish