Reset the paswords of all users in an OU
From Wiki
Creator: Guy Thomas
Script Type: VBS
This script is particularly useful for setting the paswords of users imported using CSVDE.
<vb> ' Example VBScript to require users change passwords at next logon ' Author Guy Thomas http://computerperformance.co.uk/ ' Version 2.2 - March 21st 2004 ' Editted to suit Baines School by Ric Charlton, 30/08/06 ' ---------------------------------------------------------------- Option Explicit Dim objOU, objUser, objRootDSE Dim strContainer, strLastUser, strDNSDomain, intCounter, intAccValue Set objRootDSE = GetObject("LDAP://RootDSE") strDNSDomain = objRootDSE.Get("DefaultNamingContext") strContainer = "OU=606,OU=Sixth Form,OU=Users,OU=Baines School," intAccValue = 544 strContainer = strContainer & strDNSDomain set objOU =GetObject("LDAP://" & strContainer ) intCounter = 0
For each objUser in objOU
If objUser.class="user" then
objUser.SetPassword "Baines606"
objUser.SetInfo
objUser.Put "userAccountControl", intAccValue
objUser.SetInfo
intCounter = intCounter +1
strLastUser = objUser.Get ("name")
End if
next
WScript.Echo intCounter & " Users change pwd next logon. Value " _ & intAccValue WScript.Quit </vb>


