Hackepeter
New Member
- Joined
- Feb 22, 2012
- Messages
- 2
Hi Folks,
I've tried various searches in this and other forums. Nothing helped me out with my problem. So I'm asking YOU .
I use Excel 2007.
the background:
we have a bigger AD with more than only one hirarchical level in ad.
I need to find a user with a given "sAMAccountName".
I don't know where his entry is located in the tree.
as example my user's path is:
OU=06,OU=Users,DC=domain,DC=com
others are located in other groups in group "Users". There are about 90 subgroups in this section.
What I can do ist to walk down in 2 loops from root through every object in these groups. But this can´t be the solution.
What I want is to "search" the AD and find the correct entry and it's path.
something like
search "me" in AD
returning the object "me" for accessing the needed parameters (me.name...) or me.member (which is another task why I want to have this code as generic as possible)
What I have now:
I will get an Error -2147016672 saying somthing crytic.
There must be a mistake in syntaxing the value of sAUFRUF. I'm german...
Can you hepl me?
thanks
I've tried various searches in this and other forums. Nothing helped me out with my problem. So I'm asking YOU .
I use Excel 2007.
the background:
we have a bigger AD with more than only one hirarchical level in ad.
I need to find a user with a given "sAMAccountName".
I don't know where his entry is located in the tree.
as example my user's path is:
OU=06,OU=Users,DC=domain,DC=com
others are located in other groups in group "Users". There are about 90 subgroups in this section.
What I can do ist to walk down in 2 loops from root through every object in these groups. But this can´t be the solution.
What I want is to "search" the AD and find the correct entry and it's path.
something like
search "me" in AD
returning the object "me" for accessing the needed parameters (me.name...) or me.member (which is another task why I want to have this code as generic as possible)
What I have now:
Code:
Sub test() ' will be a function later on if working
Dim colOU As IADsContainer
Dim strName as String ' --> I use a fixed value of the sAMAccountName for testing this
Dim sAUFRUF As String
strName = "userid"
sAUFRUF = "LDAP://DC=domain, DC=com, sAMAccountName=" & strName
Set colOU = GetObject(sAUFRUF) ' --> :crash:
Debug.Print colOU.Name
Debug.Print colOU.AccountExpirationDate
There must be a mistake in syntaxing the value of sAUFRUF. I'm german...
Can you hepl me?
thanks