PwdLastSet.vbs
CODE
' PwdLastSet.vbs
' VBScript to FORCE a user's password change
' Author Ulrich P amended by Guy Thomas
' Version 2.0 - October 17th 2004
' --------------------------------------------------------------'
Option Explicit
Dim objOU, objUser, objRootDSE
Dim strContainer, strLastUser, strDNSDomain, strPassword
Dim intCounter, intAccValue, intPwdValue
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("DefaultNamingContext")
intAccValue = 544
intPwdValue = 0
' -------------------------------------------------------------'
' Important change OU= to reflect your domain
' -------------------------------------------------------------'
strContainer = "OU=Accounts, "
strPassword = "P@ssw0rd"
' -------------------------------------------------------------'
' Makes the user change P@ssw0rd at first logon
' -------------------------------------------------------------'
strContainer = strContainer & strDNSDomain
set objOU =GetObject("LDAP://" & strContainer )
intCounter = 0
For each objUser in objOU
If objUser.class="user" then
objUser.SetPassword strPassword
objUser.SetInfo
objUser.Put "pwdLastSet", intPwdValue
objUser.SetInfo
objUser.Put "userAccountControl", intAccValue
objUser.SetInfo
intCounter = intCounter +1
strLastUser = objUser.Get ("name")
End if
next
WScript.Echo strPassword & " is Password. UserAccountValue = " _
& intAccValue
WScript.Quit
' End of Script
http://www.computerperformance.co.uk/ezine/ezine50.htm