Link to home
Start Free TrialLog in
Avatar of Luxtech
Luxtech

asked on

How to use a VBS script to mass change user passwords

I have just migrated from NT4 to windows 2003. I have moved over 400 users into an OU called users and want to mass change all their passwords to Password1. I have looked at a few VBS scripts but am having trouble with them. Any help would be appreciated?

Thanks!

Michael
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image


Here we go... nice and little. You'll need to fill in the password and the path for the OU. This is based on the domain name being yourdomain.local so alter as applicable.


Set objOU = GetObject("LDAP://OU=SomeOU,OU=SomeWhere,DC=YourDomain,DC=local")
objOU.Filter = Array("user")

For Each objUser in objOU
      objUser.SetPassword "NewPassword1"
Next


And that's all there is to it unless they're in sub-OUs and such.

HTH

Chris
Avatar of Luxtech
Luxtech

ASKER

Hi Chris

I am still having problems with this, I am getting an error on the script that sys:

line: 1
char: 1
Error: A referral was returned from the server.
code: 8007202b
source: (null)

I have changed the obj names to the users ou.

Thanks

Oh they're in the default Users OU? That one isn't really an OU (for whatever reason MS decided) it should be:

Set objOU = GetObject("CN=Users,DC=YourDomain,DC=local")

After that it can be treated in exactly the same way as above.

Chris
Avatar of Luxtech

ASKER

Hi Chris

Thanks for your help but I used AD infinitum to mass change everyones password which worked fine.

I appreciate your time looking into this for me!

Take care

Michael

No problem.

Chris
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial