1

I am converting a website fro being hosted on Linux and Apache to Windows and IIS. The pages are currently written in php but new functionality will be in something along the lines of C#.net

In the php files there is a popen command calling the ldapsearch command for linux and performing a query based on the users' id. What I need to do is switch this command over to dsquery, does anyone know of an easy way to convert between the two commands.

I have looked at Microsofts' documentation for dsquery but it seems lacking compared to ldapsearch. If anyone has a suggestion that may better fit this require I am open to the idea, but using dsquery or ldifde (or another built-in command) would be best.

Thank you for your help and replies.

Irukesu
  • 13
  • 1
  • 3

2 Answers2

1

PHP code should not have called ldapsearch.
instead: http://php.net/manual/en/book.ldap.php

.net code should not call dsquery.
instead: use native tools (not as easy to find online docs)
useful(?): http://www.youcanlearnseries.com/Programming%20Tips/CSharp/LDAPReader.aspx

84104
  • 12,905
  • 6
  • 45
  • 76
  • Thank you, this information is quite valuable. I am pretty much fixing a broken product and then will be replacing it after it is not completely falling apart. I have marked your answer as the right one. Also, if it helps anyone else here is how I got the dsquery to work: dsquery user -d domain -u username -p password -samid uniqueID Below Jim B using the filter argument that I didn't know about would also work to filter down by uid and would probably be more precise. Thank you all. – Irukesu Jun 14 '11 at 17:52
0

are you sure you were looking in the right place for the documentation? Here is a link to the dsquery command. the ldapsearch syntax should be very similar from a dsquery filter perspective.

off hte top of my head (meaning I didn't test this) to query for a user by uid:

dsquery * domainroot -filter "(&(objectCategory=Person)(objectClass=User)(uid='100'))" -attr samaccountname -limit 0
Jim B
  • 24,081
  • 4
  • 36
  • 60