Guest quickslip Posted August 16, 2007 Posted August 16, 2007 I have a need to reset all user objects in one of our AD containers to the same password as well as set the flag to immediately prompt for change. Does anyone have a quick and easy way to do this within a w2k3 environment? Thanks -- quickslip ------------------------------------------------------------------------ quickslip's Profile: http://forums.techarena.in/member.php?userid=22174 View this thread: http://forums.techarena.in/showthread.php?t=801889 http://forums.techarena.in
Guest Richard Mueller [MVP] Posted August 16, 2007 Posted August 16, 2007 Re: BULK password reset and flag setting quickslip wrote: > I have a need to reset all user objects in one of our AD containers to > the same password as well as set the flag to immediately prompt for > change. Does anyone have a quick and easy way to do this within a w2k3 > environment? I think this can be done with command line utilities, but a VBScript program could do this with code similar to: ========= ' Specify the Distinguished Name of the OU. strOU = "ou=West,dc=MyDomain,dc=com" ' Specify the new password for all users in the OU. strPassword = "xyz321" ' Bind to the OU. Set objOU = GetObject("LDAP://" & strOU) ' Filter on user objects. objOU.Filter = Array("user") ' Enumerate all users in the OU For Each objUser In objOU ' Set the password. objUser.SetPassword = strPassword ' Expire the account, so user is prompted to change ' it at the next logon. objUser.pwdLastSet = 0 ' Save changes. objUser.SetInfo Next Wscript.Echo "Done" =========== You could also have the script prompt for the new password by replacing: strPassword = "xyz321" with strPassword = InputBox("Enter new password") -- Richard Mueller Microsoft MVP Scripting and ADSI Hilltop Lab - http://www.rlmueller.net --
Recommended Posts