sdonaldson07
asked on
GetObject special characters
I am trying to get a list of Distribution List members from AD. I have a script that will pull the members, but I ran into an issue with the name of a specific DL. The name has spaces and commas in it, which is causing the script to freak out. I have tried:
I'm not sure how to get the script to read the name of the DL without freaking out over the commas. Any ideas?
Set objGroup = GetObject("LDAP://CN=First Last, First Last, First Last,OU=NAME,OU=All Users,DC=DOMAIN,DC=COM")
Set objGroup = GetObject('"LDAP://CN=First Last, First Last, First Last,OU=NAME,OU=All Users,DC=DOMAIN,DC=COM"')
Set strOUContainter = "CN=First Last, First Last, First Last,OU=NAME"
Set objGroup = GetObject("LDAP://" & strOUContainer & "," & "OU=All Users,DC=DOMAIN,DC=COM")
Set strOUContainter = """CN=First Last, First Last, First Last,OU=NAME"""
Set objGroup = GetObject("LDAP://" & strOUContainer & "," & "OU=All Users,DC=DOMAIN,DC=COM")
I'm not sure how to get the script to read the name of the DL without freaking out over the commas. Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes I am editing the names in my example. I made sure to only escape the characters separating the names, not the ones separating the object. I have tried setting up the CN as a variable and inserting it into the GetObject and I have also tried keeping the names in the GetObject and escaping the commas there. Neither method worked for me.
ASKER
Closing question.
ASKER
I tried to escape the commas like you suggested and got the following error message:
Microsoft VBScript runtime error: Object required: '[string: "CN=First Last\, Fir"]'
The error message did not finish the second person's first name.