Board index » Visual Studio » Dumbass newbie question

Dumbass newbie question

Visual Studio167
Hi There,



I found some VB the other day within the Script Centre repository to bring

me the members of distribution lists. It worked well the other day. When

I'm querying another domain with different naming conventions however, I'm

having problems. The main problems (I think) are the use of spaces in my OU

name, and that each DL begins with a '#' character. I found an article

within Google groups asying I should put a '\' before my '#' to cure this,

but no luck. If someone could have a look at the below and advise me of the

actual syntax I should be using, I'd be very grateful.



***************************************************

On Error Resume Next



Set objGroup = GetObject _

("LDAP://cn=#inquiries@xxxxx.com,ou=Distribution

Lists,ou=us,dc=na,dc=ad,dc=xxxxx,dc=com")

objGroup.GetInfo



arrMemberOf = objGroup.GetEx("member")



WScript.Echo "Members:"

For Each strMember in arrMemberOf

WScript.echo strMember

Next

***************************************************



Many Thanks in advance,

Orb.


-
 

Re:Dumbass newbie question

Orbital wrote:



Quote
I found some VB the other day within the Script Centre repository to bring

me the members of distribution lists. It worked well the other day. When

I'm querying another domain with different naming conventions however, I'm

having problems. The main problems (I think) are the use of spaces in my

OU

name, and that each DL begins with a '#' character. I found an article

within Google groups asying I should put a '\' before my '#' to cure this,

but no luck. If someone could have a look at the below and advise me of

the

actual syntax I should be using, I'd be very grateful.



***************************************************

On Error Resume Next



Set objGroup = GetObject _

("LDAP://cn=#inquiries@xxxxx.com,ou=Distribution

Lists,ou=us,dc=na,dc=ad,dc=xxxxx,dc=com")

objGroup.GetInfo



arrMemberOf = objGroup.GetEx("member")



WScript.Echo "Members:"

For Each strMember in arrMemberOf

WScript.echo strMember

Next

***************************************************



The "#" character does need to be escaped with "\". However, I doubt the

Common Name for this object as the "@xxxxx.com" string appended. I would

try:



Set objGroup = GetObject(LDAP://cn=\#inquiries,ou=Distribution

Lists,ou=us,dc=na,dc=ad,dc=xxxxx,dc=com)



If that doesn't work, look at the properties for this object in ADUC. On the

"Object" tab the "Fully qualified domain name of object" is not the

Distinguished Name, but it's close. If the FQDN is:



MyDomain.com/School/Students/#inquiries



then the Distinguished Name is:



cn=\#inquiries,ou=Students,ou=School,dc=MyDomain,dc=com



--

Richard

Microsoft MVP Scripting and ADSI

Hilltop Lab - www.rlmueller.net">www.rlmueller.net





-

Re:Dumbass newbie question

Hi Richard,



Thanks very much for replying, very kind. I'll give this a whirl and see

how I get on.





Thanks again,

Orb.



"Richard Mueller" wrote:



Quote
Orbital wrote:



>I found some VB the other day within the Script Centre repository to bring

>me the members of distribution lists. It worked well the other day. When

>I'm querying another domain with different naming conventions however, I'm

>having problems. The main problems (I think) are the use of spaces in my

>OU

>name, and that each DL begins with a '#' character. I found an article

>within Google groups asying I should put a '\' before my '#' to cure this,

>but no luck. If someone could have a look at the below and advise me of

>the

>actual syntax I should be using, I'd be very grateful.

>

>***************************************************

>On Error Resume Next

>

>Set objGroup = GetObject _

>("LDAP://cn=#inquiries@xxxxx.com,ou=Distribution

>Lists,ou=us,dc=na,dc=ad,dc=xxxxx,dc=com")

>objGroup.GetInfo

>

>arrMemberOf = objGroup.GetEx("member")

>

>WScript.Echo "Members:"

>For Each strMember in arrMemberOf

>WScript.echo strMember

>Next

>***************************************************



The "#" character does need to be escaped with "\". However, I doubt the

Common Name for this object as the "@xxxxx.com" string appended. I would

try:



Set objGroup = GetObject(LDAP://cn=\#inquiries,ou=Distribution

Lists,ou=us,dc=na,dc=ad,dc=xxxxx,dc=com)



If that doesn't work, look at the properties for this object in ADUC. On the

"Object" tab the "Fully qualified domain name of object" is not the

Distinguished Name, but it's close. If the FQDN is:



MyDomain.com/School/Students/#inquiries



then the Distinguished Name is:



cn=\#inquiries,ou=Students,ou=School,dc=MyDomain,dc=com



--

Richard

Microsoft MVP Scripting and ADSI

Hilltop Lab - www.rlmueller.net">www.rlmueller.net







-