[windows2000] Re: Resetting Password Expiration

  • From: Jeff Malczewski <jmalczewski@xxxxxxxx>
  • To: "'windows2000@xxxxxxxxxxxxx'" <windows2000@xxxxxxxxxxxxx>
  • Date: Fri, 21 May 2004 13:46:23 -0400

Same thing, just the LDAP version instead of the WINNT version..  I also
have the IADS version handy if anyone wants that, too...

It would seem to me in your IF statement, though, that you forgot the <>
evaluation...



-----Original Message-----
From: Sullivan, Glenn [mailto:GSullivan@xxxxxxxxxxxxxx]
Sent: Friday, May 21, 2004 1:39 PM
To: windows2000@xxxxxxxxxxxxx
Subject: [windows2000] Re: Resetting Password Expiration


Here you go:

<----Start Indented Script--------->
Const ADS_UF_DONT_EXPIRE_PASSWD = &H10000

On Error Resume Next
Set objOU = GetObject _
    ("LDAP://cn=Users,dc=DavidClark,dc=com";)
  
ObjOU.Filter= Array("user")

For Each objUser in objOU
        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
        End If
Next
<-----End Indented Script--------->

If that gets all screwed up by line wraps, here is a version that is not
indented...

<----Start unindented Script--------->
Const ADS_UF_DONT_EXPIRE_PASSWD = &H10000

On Error Resume Next
Set objOU = GetObject _
    ("LDAP://cn=Users,dc=DavidClark,dc=com";)
  
ObjOU.Filter= Array("user")

For Each objUser in objOU
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
End If
Next
<-----End unindented Script--------->

Please make sure that you test on a couple of spare accounts in a test OU.
If the users are in a OU instead of the default "users" container, change
the LDAP connection string as follows:
("LDAP://ou=<OU Name>,dc=<DomainName>,dc=com")

Using "ou=" for organizational units, and "cn=" for default containers.

HTH,

Glenn Sullivan, MCSE+I  MCDBA
David Clark Company Inc. 

-----Original Message-----
From: windows2000-bounce@xxxxxxxxxxxxx
[mailto:windows2000-bounce@xxxxxxxxxxxxx]On Behalf Of Puetz, Christoph
Posted At: Friday, May 21, 2004 1:23 PM
Posted To: Windows 2000
Conversation: [windows2000] Resetting Password Expiration
Subject: [windows2000] Resetting Password Expiration


Is there an easy to remove the password expiration (to not expire) on 500
users with a script? We're finally allowed to have passwords expire and
force users to change it. I do not want to click 500 check boxes to uncheck
this setting in AD.

Christoph

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
********************************************************
This Weeks Sponsor StressedPuppy.com Games
Feeling stressed out? Check out our games to
relieve your stress.
http://www.StressedPuppy.com
********************************************************
To Unsubscribe, set digest or vacation
mode or view archives use the below link.

http://thethin.net/win2000list.cfm
********************************************************
This Weeks Sponsor StressedPuppy.com Games
Feeling stressed out? Check out our games to
relieve your stress.
http://www.StressedPuppy.com
********************************************************
To Unsubscribe, set digest or vacation
mode or view archives use the below link.

http://thethin.net/win2000list.cfm

This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. If 
you have received this email in error please notify the system manager. This 
message contains confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail.
********************************************************
This Weeks Sponsor StressedPuppy.com Games
Feeling stressed out? Check out our games to
relieve your stress.
http://www.StressedPuppy.com
********************************************************
To Unsubscribe, set digest or vacation
mode or view archives use the below link.

http://thethin.net/win2000list.cfm

Other related posts: