[windows2000] Re: Force Password change on next logon

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

Never mind .... :-)
 
Option Explicit
Dim objOU, objUser, objRootDSE
Dim strContainer, strLastUser, strDNSDomain, intCounter, intAccValue
Set objRootDSE = GetObject("LDAP://RootDSE";)
strDNSDomain = objRootDSE.Get("DefaultNamingContext")
strContainer = "OU=Beta ,"
strContainer = strContainer & strDNSDomain
set objOU = GetObject("LDAP://"; & strContainer )
      For each objUser in objOU
          If objUser.class="user" then
          objUser.Put "pwdLastSet", 0
          objUser.SetInfo
          End if
       next
WScript.Echo intCounter & " Users change pwd next logon.  Value " _
& intAccValue
 
WScript.Quit

________________________________

From: windows2000-bounce@xxxxxxxxxxxxx
[mailto:windows2000-bounce@xxxxxxxxxxxxx] On Behalf Of Puetz, Christoph
(TH USA)
Sent: Monday, October 25, 2004 2:13 PM
To: windows2000@xxxxxxxxxxxxx
Subject: [windows2000] Force Password change on next logon


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 _
    ("LDAP://CN=myerken,OU=management,DC=Fabrikam,DC=com";)
objUser.Put "pwdLastSet", 0
objUser.SetInfo

 
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?
 
Christoph
 
  


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 )
WScript.Quit

Other related posts: