Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Re: BULK password reset and flag setting

Reply
Thread Tools Display Modes

Re: BULK password reset and flag setting

 
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      08-16-2007
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
--


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59