Hi,
I'm not sure if this is an active directory issue, or a VB issue. I've got
some code to convert an NT login name to a Distinguished Name so I can query
an Active Directory server. Unfortunately, it always returns an empty string
instead of the distinguished name.
I'm using VB 6 and Windows 2003 Server as a test server. Querying the AD
server with the distinguished name works correctly.
Anyhoo, here's the code:
-------------------------------------------
Dim strNetBIOSDomai n As String
Dim oTrans As New NameTranslate
oTrans.Init 3, ""
oTrans.Set 3, LoginName 'LoginName is a string.
strNetBIOSDomai n = oTrans.Get(3)
MsgBox strNetBIOSDomai n + vbCrLf + CStr(Len(strNet BIOSDomain))
-------------------------------------------
The output of this is a msgbox if I use a correct login name (e.g.
administrator):
___________
| Title |
|___________|
| |
| 0 |
---------------
or an error message saying "Could not find name" if I use an incorrect login
name (e.g. administtttttra tor )
Thanks in advance,
Rowland.
Has anybody got any clues as to why this happens?
I'm not sure if this is an active directory issue, or a VB issue. I've got
some code to convert an NT login name to a Distinguished Name so I can query
an Active Directory server. Unfortunately, it always returns an empty string
instead of the distinguished name.
I'm using VB 6 and Windows 2003 Server as a test server. Querying the AD
server with the distinguished name works correctly.
Anyhoo, here's the code:
-------------------------------------------
Dim strNetBIOSDomai n As String
Dim oTrans As New NameTranslate
oTrans.Init 3, ""
oTrans.Set 3, LoginName 'LoginName is a string.
strNetBIOSDomai n = oTrans.Get(3)
MsgBox strNetBIOSDomai n + vbCrLf + CStr(Len(strNet BIOSDomain))
-------------------------------------------
The output of this is a msgbox if I use a correct login name (e.g.
administrator):
___________
| Title |
|___________|
| |
| 0 |
---------------
or an error message saying "Could not find name" if I use an incorrect login
name (e.g. administtttttra tor )
Thanks in advance,
Rowland.
Has anybody got any clues as to why this happens?
Comment