After more research I discovered this is easier than I thought all you need is the following command:
dsquery user domainroot -samid %USERNAME%
You can run it from a batch file and it will return the current users first, last name and middle initial which is what I was looking for. I would still...
Thanks for the reply.
The original error "Object required" was on line 16:
oCommand.CommandText = "<LDAP://" & domain & _
">;(&(objectCategory=User)(UserName=" & userName & "));name;subtree"
When I substitute the line you suggested:
oCommand.CommandText = "<LDAP://" & domain & _...
I am trying to get the full name of the current user. So far I have been able to figure out how to talk to the Active Directory server and how to get the current users login name, but I am not sure how to query the Active Directory for the users full name. Can anyone help me out? Here is my code...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.