Jun 17, 2008
I'm having a weird problem with active directory and the display name attribute. I can create an AD account with no problems, the account shows up, I can log on as the account, everything appears to be working as intended. The problem is, our company requires that the display name be in the form of "Lastname, Firstname". Thats all fine and dandy when you create an AD account use the MMC snap-in, you type in the users name as "Lastname, Firstname" in the display name field and when the account is created, the display name shows as "Lastname, Firstname" as you would expect.
View 2 Replies
The problem I am having is this, whenever I create an AD account programmatically, I can't for the life of me get the display name to show up as "Lastname, Firstname". The displayname property is set as such, checking the AD account using the MMC snap-in shows the display name is set correctly, but when looking at the list of user accounts, the account is always displayed as the users username. The account name I am using is "Test User", see pic below.
if you try to rename the account, the field it tells you it is editing is called Full Name? I can't find a property in AD even called Full Name so I am completely confused, here is a picture of me trying to rename the programmatically created account, as you can see, the display name field is set correctly even though it doesn't display that way. And of course, after renaming the account as seen below, the display name shows up correctly as "Lastname, Firstname"Here is the code I use to create the account, just for reference.
Public Sub CreateActiveDirectoryAccount(ByVal sUserName As String, ByVal sFirstName As String, _
ByVal sLastName As String, ByVal sUserPrincipalName As String, ByVal sPassword As String, _
ByVal sHomeDrive As String, ByVal sHomeDirLocation As String, _