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

userPrincipalName

Status
Not open for further replies.

fpachon

MIS
Feb 9, 2006
22
US
Hi all,

I am trying to populate this field using my code.
But when I do I only see this for example

fpachon

under the user logon name under the accout tab

When I create a user manullly using Active Directory Users Computers, I see

mpachon
and the next field already has the @domain prefilled.

Can someone help me sort this out.

Thanks.

wscript.Echo "First Name: " & user_array(0)
new_str = left(user_array(0),1)
wscript.Echo "userPrincipalName = " & new_str & user_array(1)

Set objUser = objOU.Create("User", "cn=" & user_array(0) & user_array(1))
objUser.Put "sAMAccountName","" & user_array(0) & user_array(1)
objUser.Put "userPrincipalName","" & new_str & user_array(1)
objUser.SetInfo

 
>But when I do I only see this for example
>fpachon
>under the user logon name under the accout tab
>When I create a user manullly using Active Directory Users Computers, I see
>mpachon
>and the next field already has the @domain prefilled.

Why fpachon becoming mpachon if not you entered differently in user_array(0)? Why is it surprising if the gui have some default suggestion...?

 
My apologies. Both examples should have read fpachon. When I use the gui to create the user I get fpachon and @domain in the proper field. BUt when I use the script only fpachon shows up. The domain field is a drop down box so when I hit the drop down box then I see the @domain filed where I then choose it and hit the apply button.

I hope this helps.

Thank you.
 
If you have built a forrest of your AD, you can add another if the maildomain i9s in 2 way trust.

otherwise only the default domain i settable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top