By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,649 Members | 2,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,649 IT Pros & Developers. It's quick & easy.

Passing command-line argument to Active Directory query.

P: n/a
I'm new to C# and am having trouble with the following code:
DirectoryEntry root = new DirectoryEntry("LDAP://<DOMAIN>");
DirectorySearcher searcher = new DirectorySearcher(root);
searcher.Filter = "(&(objectCategory=computer)(name=<MACHINE>))" ;
SearchResultCollection results = searcher.FindAll();
The plan is to specify 2 or more command-line parameters (/machine:<MACHINE>) and have that value be passed to (name=<MACHINE>) in the query filter. As it stands, the query works fine as long as I manually include a machine name in the code. However, I'm having trouble getting the variable data passed. Any suggestions would be much appreciated. Thanks in advance.
Nov 15 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.