Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADSI "UserAccountControl" option 1

Status
Not open for further replies.

Niavlys

IS-IT--Management
Jun 3, 2002
197
CA
Hi, I created a script to import users from a file. Everything's ok except user options. A red a lot about the User flags that you can set to get what you want but I don't know how to set the "user must change password at next logon" option.
This part of the script goes like this:
Code:
Set usr = GetObject("LDAP://CN=username,organization,DC=domain,DC=com" )
flag = usr.Get("UserAccountControl")
newFlag = flag OR &h220   ' here is where you mask the 
                          ' the good bits
usr.Put "UserAccountControl", newFlag

wscript.echo usr.Get("UserAccountControl")
usr.setinfo

It doesn't work like it should, options never change.

You can find information on that site:

Can anyone help me!
thanks a million.
 
code below

Set objUser = GetObject _
("LDAP://CN=myerken,OU=management,DC=Fabrikam,DC=com")
objUser.Put "pwdLastSet", 0
objUser.SetInfo



where myerken = userid

Taken from technet scripting

Regards
Steve Friday
 
Thank you very much, it worked great!
[bigsmile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top