Advertisement

04.22.2008 at 05:29AM PDT, ID: 23342612
[x]
Attachment Details

Disable "password never expires" option for all or some users in Server 2000 domain

Asked by dougdog in Miscellaneous Security, Windows Network Security, Windows 2003 Server

Tags: , , ,

Hi experts
I have just applied a new password policy, however a lot of users have their password never expires option ticked.
I need to untick this option for most of my users apart from systems accounts etc.
I know this has beed answered before however the script posted is not working for me
this is the line it fails on   If strUserDN "  " Then
i have exported all usernames as stated by the expert
the script im using is below
any ideas
the original question was http://www.experts-exchange.com/Security/Q_21821175.html

Option Explicit
Const ADS_UF_DONT_EXPIRE_PASSWD = &H10000
Dim lngFlag, objUser, objFSO, strFilePath, objFile
Dim strUserDN

' Specify the text file of user names.
strFilePath = "c:\MyFolder\UserList2.txt"


' Open the file for read access.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFilePath, 1)

' Read each line of the file, bind to the user object, and toggle
' "Password Never Expires" to false if needed.
Do Until objFile.AtEndOfStream
strUserDN = Trim(objFile.ReadLine)
If strUserDN "  " Then
On Error Resume Next
Err.Clear
Set objUser = GetObject("LDAP://" & strUserDN)
If Err.Number 0 Then
Err.Clear
Wscript.Echo "User NOT found " & strUserDN
Else
lngFlag = objUser.Get("userAccountControl")
If (lngFlag And ADS_UF_DONT_EXPIRE_PASSWD) 0 Then
lngFlag = lngFlag Xor ADS_UF_DONT_EXPIRE_PASSWD
objUser.Put "userAccountControl", lngFlag
objUser.SetInfo
If Err.Number 0 Then
Err.Clear
Wscript.Echo "Unable to set flag for " & strUserDN
End If
End If
End If
On Error GoTo 0
End If
Loop

' Clean up.
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
Set objUser = Nothing

Wscript.Echo "Done"
Start Free Trial
[+][-]04.22.2008 at 05:36AM PDT, ID: 21410374

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 05:41AM PDT, ID: 21410410

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 05:42AM PDT, ID: 21410419

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 05:43AM PDT, ID: 21410424

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 05:44AM PDT, ID: 21410436

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 06:07AM PDT, ID: 21410693

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 06:08AM PDT, ID: 21410701

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 06:17AM PDT, ID: 21410779

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 06:46AM PDT, ID: 21411022

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 06:48AM PDT, ID: 21411028

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 06:50AM PDT, ID: 21411052

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 06:52AM PDT, ID: 21411079

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 07:03AM PDT, ID: 21411179

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 07:06AM PDT, ID: 21411205

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 07:15AM PDT, ID: 21411291

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 11:02AM PDT, ID: 21413756

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 11:04AM PDT, ID: 21413768

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 11:05AM PDT, ID: 21413775

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 12:19PM PDT, ID: 21414499

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 11:44PM PDT, ID: 21418213

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 11:45PM PDT, ID: 21418220

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.22.2008 at 11:47PM PDT, ID: 21418227

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Miscellaneous Security, Windows Network Security, Windows 2003 Server
Tags: Microsoft, Windows Server, 2003, Scripting
Sign Up Now!
Solution Provided By: masa77
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628