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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Active Directory object property names

Status
Not open for further replies.

trinzul

IS-IT--Management
Feb 16, 2004
13
US
Hey,

Does anyone know where a list of active directory property key names can be found? Here is my problem:
I'm trying to write users to a Server 2003 active directory. Here is the code I have so far...

DirectoryEntry OU= entry.Children.Find("CN=USERS");
DirectoryEntry NewUser = OU.Children.Add("CN=TESTUSER", "User");

NewUser.Properties["sAMAccountName"].Value = "TEST";
NewUser.Properties["userPrincipalName"].Add("TESTUSER@test.com"); NewUser.Properties"GivenName"].Add "FirstName");
NewUser.Properties["initials"].Add("TU");
NewUser.Properties["sn"].Add("LASTNAME");
NewUser.Properties["displayName"].Add("TEST");
NewUser.Properties["description"].Add("TEST");
NewUser.CommitChanges();
NewUser.Invoke("SetPassword", "temp");
NewUser.Properties["PwdLastSet"].Value = 0;
NewUser.CommitChanges();


The problem here is that this will create a new user, but the account is disabled. What i really need to do is create the account but also set the account as active. I can't seem to find out what the key word is for that property setting. Any help would be great,

Thanks,
Brandon
 
Heres a link to the AD schema site on MSDN, its bound to be in there somewheer but i don't have time right nwo to hunt it down...


Rob

Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Eisenhower 1953
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top