Login | |
|
 |
RE: Change Password for everyone in a OU - 9/8/2005 8:38:54 PM
|
|
 |
|
| |
cjwallace
Posts: 491
Score: 0
Joined: 3/5/2005
From: United Kingdom
Status: offline
|
Not to worry. I have found a script to walk through a OU and change the passwords Option Explicit Dim objOU, objUser, objRootDSE Dim strContainer, strDNSDomain, strPassword Dim intCounter, intAccValue, intPwdValue ' --------------------------------------------------------' ' Note: Please change OU=nowhere, to reflect your domain ' --------------------------------------------------------' strContainer = "OU=TEST,OU=LONDON USERS,OU=WITHERS USERS," strPassword = "Passw0rd" intAccValue = 544 rem Unrem line 58 and also unrem line 73 to force the user to reset the their rem password at next logon. rem intPwdValue = 0 intCounter = 0 ' -------------------------------------------------------' ' Makes the user change Passw0rd1 password at first logon ' -------------------------------------------------------' Set objRootDSE = GetObject("LDAP://RootDSE") strDNSDomain = objRootDSE.Get("DefaultNamingContext") strContainer = strContainer & strDNSDomain Set objOU =GetObject("LDAP://" & strContainer ) For Each objUser In objOU If objUser.class="user" Then objUser.SetPassword strPassword objUser.SetInfo rem objUser.Put "pwdLastSet", intPwdValue objUser.SetInfo objUser.Put "userAccountControl", intAccValue objUser.SetInfo intCounter = intCounter +1 End If Next WScript.Echo strPassword & " is Password. UserAccountValue = " _ & intAccValue & vbCr & intCounter & " accounts changed" WScript.Quit ' End of change password example VBScript
|
|
| |
|
|
|
 |
RE: Change Password for everyone in a OU - 9/8/2005 8:43:44 PM
|
|
 |
|
| |
Snipah
Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
|
Set objOU = GetObject("LDAP://*") strPassword = "NewPassword" objOU.Filter = array("user")" for Each objUser in objOU If objUser.class="user" Then objUser.SetPassword strPassword objUser.SetInfo rem objUser.Put "pwdLastSet", intPwdValue objUser.SetInfo objUser.Put "userAccountControl", intAccValue objUser.SetInfo next //edit: Oops too late....
< Message edited by Snipah -- 9/8/2005 8:44:48 PM >
_____________________________
For more information, please see the "Read me First" topic. http://www.visualbasicscript.com
|
|
| |
|
|
|
|
|