Posts

Showing posts with the label Active Directory

Enumerating Active Directory object properties using C#

I had to look up for a properties in Active Directory against my login. Since I didn’t even know the name of properties, I had to enumerate through them. Here is the code. 1. Create C# application and add a configuration file “app.config”. 2. Update it as follows: <configuration>   <appSettings>     <add key="ADDomain" value="mydomain"/>     <add key="username" value="username"/>   </appSettings> </configuration> Update your “domain” and “username”. 3. Add following code in Main method (usually in program.cs file) try {     using (DirectoryEntry de = new DirectoryEntry(@"LDAP://" + ConfigurationSettings.AppSettings["ADDomain"]))     {         using (DirectorySearcher adSearch = new DirectorySearcher(de)) ...

Search User on Active Directory

If you know first or last name or both, you can look it up in active directory for details (such as email/title/phone etc) Simply create a shortcut on your desktop and point it to following: %SystemRoot%\System32\rundll32.exe dsquery,OpenQueryWindow Now double click the shortcut and search!