How would I convert this command line (from a .bat) into something I could use in C#?
dsquery user forestroot -samid "%%d" | dsget user -display -upn -office -tel -mobile -dept | FIND /V "dsget"
I am not familiar with bat scripting in the slightest, the above does what I want it to but I really don't understand what keywords in the command do what......if possible though I do need to get that working in c#, so what c# functionality would I want to look for and are there any tutorials on using it? I know there is a DSQuery function in c#, I just can't find very good examples on its usage.
Hoping it wont be too difficult.. dsquery is a tool to query active directory services.. I've never done it myself but the following article on querying anything about AD in C# is well rated and should be of use:
That looks like a great C# ActiveDirectory resource, however after looking through it myself the only relevant section to what I am trying to do is the "Active Directory Users Tasks" section (last one at the end), and there do not seem to be any functionality around using dsquery/dsget to look up a user, it all seems focused around normal administrative tasks (adding/removing a user, locking/unlocking a user, etc).
Anyone have any more resources I can search through or know of how to do this?
Thanks Silent, using the DirectoryService namespace is sort of what I'm looking for. Ideally, I want to get the same information that the command in my original post gets, but preferably, through C#, not through a command line.
The only problem is I only have a minor understanding of AD, and have never used the DirectoryService namespace, so I have a hard time understanding exactly how the command works, and so far a better understanding of DirectoryService, but not enough to really do anything on my own yet.
Any other tips? From what I can understand, I basically need to look up some Active Directory info using something along the lines of DSQuery, is that built-in C# by default or something I would need to find a library for?