locked
Resetting the password for multiple users RRS feed

  • Question

  •  I have 700 users that I need to reset their passwords to one single password.  Is there any way to do this in Windows 2003 Active Directory? The users are all in one OU.

    Any help would be appreciated.

    Thanks
    Tuesday, August 19, 2008 8:40 AM

Answers

  • I did this some time ago. Hope it helps.

    http://dennisitpro.spaces.live.com/blog/cns!66E6F2EEAC5B826B!284.entry

    Grabbing every user in an OU and reset their password

    I was just being asked casually if this is possible.
    She wanted to use a script, grab all the user accounts in the OU and reset their password to something, then output the list to a prompt. And i took up my keyboard (instead of a pen) and started this simple task for her. (Hey, this earned me a lunch date with a lady ok?)
     
     
    Anyway, there are the codes.
    =================================================================
    dim OutPutList
    dim Password
     
    Set ObjOU = GetObject("LDAP://ou=Class,dc=contoso,dc=msft")
    ObjOU.Filter = Array("User")
     
    OutputList = ""
    Password = "PassW0rd"   'I simply preset the password to something. You can change this accordingly
     
    For Each objUser in ObjOU
    'If you want to have random password, call a function to randomize a password before you call the SetPassword method
       objUser.SetPassword Password
       OutputList = Outputlist & objUser.Name & " - " & password & vbcrlf
    Next
    Wscript.echo OutputList
    'Prompts out what is the list on screen. You can replace this with a script to output to file
    ================================================================
     
    Save the codes to a .vbs, change the LDAP string.
    To save the output to a file, use this command "cscript script.vbs /Nologo >> Results.txt"
    Use notepad and open the Results.txt, should work.
     

    Dennis Chung | IT Pro Evangelist | Microsoft Singapore
    http://pingdennis.com
    Friday, October 17, 2008 5:20 AM