[windows2000] Force Password change on next logon

  • From: "Puetz, Christoph (TH USA)" <christoph.puetz@xxxxxxxxxxx>
  • To: <windows2000@xxxxxxxxxxxxx>
  • Date: Mon, 25 Oct 2004 14:12:42 -0600

I am trying to set the "User must change password at next logon" flag on
all user in a specific OU. I had no problems getting a script to work
that does it per user. But it is quite cumbersome if you have several
hundred users in that OU.
Any idea how to do it per OU and all users listed in that OU?
The code I have so far is:
Set objUser = GetObject _
objUser.Put "pwdLastSet", 0

I also tried the code below but it does not work. Anyone here who
eventually can help me figure that out or has an existing script that
resets the flag to force a password change on the next logon?

Option Explicit
Dim objOU, objUser, objRootDSE
Dim strContainer, strLastUser, strDNSDomain, intCounter, intAccValue
Set objRootDSE = GetObject("LDAP://RootDSE";)
strDNSDomain = objRootDSE.Get("DefaultNamingContext")
strContainer = "OU=test ,"
intAccValue = 544
strContainer = strContainer & strDNSDomain
set objOU =GetObject("LDAP://"; & strContainer )

Other related posts: