Discussion Locked

Password never expires

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I have aprox. 2500 users and 300-400 of them have password never expire. I am looking for a batch utility that will give me a listing of all users with the password never expire checked. Then to follow up with another batch file to remove that option. The "net user" option will not help - I am unable to find an option specifically for password never expire.

7 replies

by mmanning74

I belive that there is a utlity on the NT 4 Server Resource kit, it looks at the C2 classification setup of the server but it also looks at your issue and then tells you what needs to be done and it i belives that it will rectify this for you. Alternatively Policy i belive can also do this for you.

by lbischofs

Here's a WSH script you can use... It writes to an Excel spreadsheet.
On Error Resume Next

Const UF_HOMEDIR_REQUIRED = &H0008
Const UF_LOCKOUT = &H0010
Const UF_PASSWD_NOTREQD = &H0020
Const UF_PASSWD_CANT_CHANGE = &H0040
Const UF_TEMP_DUPLICATE_ACCOUNT = &H0100
Const UF_NORMAL_ACCOUNT = &H0200
Const UF_INTERDOMAIN_TRUST_ACCOUNT = &H0800
Const UF_WORKSTATION_TRUST_ACCOUNT = &H1000
Const UF_SERVER_TRUST_ACCOUNT = &H2000Const UF_DONT_EXPIRE_PASSWD = &H10000
Const UF_MNS_LOGON_ACCOUNT = &H20000

Dim RowNumber, ColumnNumber, XL, acctexp, MyPos, myUser, Input
ColumnNumber=1
RowNumber=1
Input = InputBox("Enter Domain name","Make Domain Choice")Set XL = CreateObject("Excel.Application")
XL.workbooks.add
XL.Visible = TRUE

XL.Cells(RowNumber, ColumnNumber).Value = "UserID"
XL.Cells(RowNumber, ColumnNumber+1).Value = "UserName"
XL.Cells(RowNumber, ColumnNumber+2).Value = Input & " Domain"
RowNumber=RowNumber+1

Set Group = GetObject("WinNT://" & Input & "/domain users")
For Each Member in Group.Members
MyPos = Instr(1, member.name, "$")
if MyPos = 0 then
Set myUser = GetObject("WinNT://" & Input & "/" & member.name)
Set acctexp = myUser.Get("AccountExpirationDate")
If myUser.UserFlags And UF_DONT_EXPIRE_PASSWD Then
XL.Cells(RowNumber, ColumnNumber).Value = member.name
'XL.Cells(RowNumber, ColumnNumber+1).Value = member.fullname
XL.Cells(RowNumber, ColumnNumber+1).Value = acctexp
XL.Cells(RowNumber, ColumnNumber+2).Value = "Password does not expire"
RowNumber=RowNumber+1
End If
end if
Next
Set XL=nothing
MsgBox ("Done")
WScript.Quit

by lynn.mcbee

This a great script!!! Do you have a script where I can remove "password never expire" without going into UM for Domain? The program Hyena is also helping, but the scrip is what I perfer.

This discussion is closed to new replies.