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!

changing the Account User Logon Name for an AD User Object 1

Status
Not open for further replies.

DougInCanada

Technical User
Feb 1, 2004
98
CA
After creating a user object with a Distinguished Name ie:

Code:
Set objOU = GetObject("LDAP://OU=Company Users,dc=domain,dc=com")

Set objUser = objOU.Create("User", "cn=Jimmy Hoffa")
objUser.Put "sAMAccountName", "Jimmy Hoffa")
objUser.SetInfo

How do I set his Account domain Logon Name (ie: HOFFAJ) via vbscript ?
 
My Bad...sAMAccountName IS the donain logon name account. "Jimmy Hoffa" is the DistinguishedName...Answered my own question...
 
Here's some that we use:
Code:
    objUser.Put "GivenName",                  strFirstName    	' First Name
    objUser.Put "SN",                         strLastName     	' Last Name
    objUser.Put "DisplayName",                strUserName     	' Display Name
    objUser.Put "Description",                strDescription  	' Description
    objUser.Put "PhysicalDeliveryOfficeName", strOffice       	' Office
    objUser.Put "st",                  		 strOffice       	' State/Province
	objUser.Put "TelephoneNumber",            strPhoneNumber  	' Telephone Number
    objUser.Put "SAMAccountName",             strPre2kLogon   	' Pre Windows 2000 logon name * MUST BE UNIQUE *
    objUser.Put "UserPrincipalName",          strPost2kLogon  	' POST Windows 2000 logon name * MUST BE UNIQUE *

I think the one you need is 'UserPrincipalName'.

JJ
[small][purple]Variables won't. Constants aren't[/purple]
There is no apostrophe in the plural of PC (or PST, or CPU, or HDD, or FDD, or photo, or breakfast...and so on)[/small]
 
Thanks, JPJ, omitting UserPrincipleName would have been a serious oversight!

Much appreciated,

Doug
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top