Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CN UserName With Comma using VBScript LDAP Query

Status
Not open for further replies.

Armstrong

IS-IT--Management
May 15, 2001
34
0
0
US
Hi all,

I am trying a simple LDAP Query to get "Last Password Change" from 2000 Active Directory and I am having a problem passing the CN since it is using the display name which contains a comma. Here is my code:

'strNamValue = "PLAINUSER"
strNamValue = "LastName, FirstName"
'NT AccountName = LastName_FirstName (doesn't work either)


Set objUser = GetObject ("LDAP://cn=" & strNamValue & ",ou=Users - ABC IBS,ou=Santa Ana,dc=corp,dc=RBB-inc,dc=com")
dtmValue = objUser.PasswordLastChanged
Wscript.echo "Password Last Changed: " & dtmvalue

This works for plainuser (which is also in the same location as all of the users I need to get to under the ABC IBS Group).

I am either getting "Invalid dn syntax" due to the comma, or I am getting "Object not on server" I don't know where to go with this.

Thanks in advance,
Armstrong


Greg Armstrong
A+ MCSE+I :)
 
Problem solved by tsuji in VBScript Forum! Thanks tsuji, you rock! He solved it using an escape character. I didn't even know there was an escape character for LDAP.

Here is resolution for your convenience:

Hello Armstrong,

Try this.
strNamValue = "LastName\, FirstName"

regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top