views:

46

answers:

1

In active directory on the user properties dialog and the account Tab there is a field. The first textbox at top left is "User login name:”, to the right of that there is a dropdown with @domain.local. Does anyone know what property or object needs to be populates to put a value here when creating user programmatically?

A: 

That's the userPrincipalName (UPN). You typically set it to the value of sAMAccountName and add @domain.local. If your using the dsadd user command you need to specify the -upn parameter for this to be populated.

Per Noalt
NewUser.Properties["userPrincipalName"].Value =strLoginName; Populates the only "User login name:” field NewUser.Properties["userPrincipalName"].Value = "@MyDomain.local"; Popluate only the domain field NewUser.Properties["userPrincipalName"].Value = strLoginName + "@MyDomain.local"; Populates both..... Thanks so much for your help!!!
Gene Butler
Always use NewUser.Properties["userPrincipalName"].Value = strLoginName + "@MyDomain.local"; - setting just one will result in errors. userPrincipalName is stored as a whole string in AD. If you're happy with the answer click on the up arrow and the check mark to accept my answer.
Per Noalt