Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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

share|improve this answer
    
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
add comment

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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.