Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 148
  • Last Modified:

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

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.SetInfo
     User.SetPassword "xxxxx"
     User.AccountDisabled = False
     User.Put "userAccountControl", &h10000
     User.SetInfo

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.

Thanks
MK
0
murugnank
Asked:
murugnank
  • 2
  • 2
1 Solution
 
oBdACommented:
That would probably be "userPrincipalName".
0
 
murugnankAuthor Commented:
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
MK
0
 
oBdACommented:
Use the full name instead of just the logon name.
User.Put "userPrincipalName", Uid@your.active.directory.
0
 
murugnankAuthor Commented:
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
MK
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now