User logon name is not getting set when creating user using vbs script.

Posted on 2003-03-19
Medium Priority
Last Modified: 2010-04-13
Hi Experts:

I am using the follwoing script to create users in my w2k active directory

Set User = Container.Create("User", "CN=" & Fname & " " & Lname)
     User.Put "samAccountName", Uid
     User.Put "givenName", Fname
     User.Put "sn", Lname
     User.Put "displayName", Fname & " " & Lname
     User.SetPassword "xxxxx"
     User.AccountDisabled = False
     User.Put "userAccountControl", &h10000

Everything is working great, except when I right click the user -> Go to Proerties -> Go to Account Tab -> I am not seeing the user  Logon name. The account works fine . I am seeing the logon name under pre-windows logon name though. I just copy and paste it from there to the logon name and managing it.

Any idea why the logon name is not geting set when using script?. What is the parameter I can use to set the logon name.

Question by:murugnank
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 85

Accepted Solution

oBdA earned 500 total points
ID: 8172587
That would probably be "userPrincipalName".

Author Comment

ID: 8175933
Thank you.. It worked..

I used it like

User.Put "userPrincipalName", Uid

Other question i have in this same problem is, right after the logon name the logon domain name is also not appearing when using script.

in the User -> Properties -> Security tab. I am able to get the logon name now. But domain information "@xxxxx" is not appearing. So I am manually selecting it from the pul down. Any parameter I can  use to set this one too?

Thanks again for the tip
LVL 85

Expert Comment

ID: 8183455
Use the full name instead of just the logon name.
User.Put "userPrincipalName", Uid@your.active.directory.

Author Comment

ID: 8183867
Ok  Thanks

Now I am noticing the domain name is also showing up just by using Uid in the UserPrincipalName.

May be the domain name was not showing up whenver I used to run the script from remote desktop( with admin pack installed) and it is working if I run the script directly at the server.

Anyway is working now just by giving Uid in the Principalname field. I will use your tip if I see the problem again.

Thanks again

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question