active-directory

Get unknown error (0x80005000) when running code: set password user account

This code failed on this line with unknown error (0x80005000) using System; using System.DirectoryServices; // correct the userPath!!! string userPath = "WinNT://"+Environment.MachineName+"/"+Environment.UserDomainName+"//"+Environment.UserName; using (DirectoryEntry userEntry = new DirectoryEntry(userPath)) { object[] passw...

Administrative Limit Exceeded During C# LDAP Search

I am trying to do a LDAP Search however I keep getting the following error: Unhandled Exception: System.Runtime.InteropServices.COMException (0x80072024): T he administrative limit for this request was exceeded. at System.DirectoryServices.SearchResultCollection.ResultsEnumerator.MoveNext () at System.DirectoryServices.DirectoryS...

How does the new UserPrincipal.LastLogon Property function in DirectoryServices.AccountManagement?

Hi, I am trying to use the new System.DirectoryServices.AccountManagement library to search the Active Directory and get the LastLogon times for users. I am using code that is very similar to the code found here: http://www.codeproject.com/KB/system/usingAccountManagement.aspx I create a PrincipalContext object using a statement like:...

How can I get tokenGroups from active directory on Windows Server 2003?

I'm trying to load tokenGroups from Active Directory but it isn't working once deployed to a Windows Server (2003). I cannot figure out why, since it works fine locally... Here is my error: There is no such object on the server. And here is my code (the sid variable is the current users SecurityIdentifier pulled from HttpContext):...

Active Directory search of Global Catalog When Using Sys.AD.AM .Net 3.5 Class

I am using the System.DirectoryServices.AccountManagement class for querying the Active Directory. I'm able to query the domain using various contexts fine, but every example I've found requires a domain name. string domain = "MYDOMAIN"; PrincipalContext ctx= new PrincipalContext(ContextType.Domain, domain); Normally this wouldn't be...

How can I get the local group name for guests/administrators ?

Question: I use the code found at http://support.microsoft.com/kb/306273 to add a windows user. The problem is i need to add the user to a group, but the groupnames are localized. E.g. the MS-example uses an english computer, which means you can get the guest group like this: grp = AD.Children.Find("Guests", "group") But on a non-eng...

How to find global catalog of Active Directory?

I want to search for users in an Active Directory environment with GC://DC=xxx,DC=yyy,DC=zzz format. But how can I programmatically find the global catalogs in an arbitary Active Directory environment? Does each domain name correspond to a global catalog always? Any alternative means I can try? Note: The Forest.FindAllGlobalCatalogs() r...

How can you test if an AD password will meet configured complexity requirements?

Hi In a net 3.5 csharp application I need to know in advance if an AD password will meet configured complexity requirements. How can you do that? TIA ...

Directory Services, Search all available providers.

Hello, I have the following method used for searching for a User Group either on the local computer (done first) or in the Current Forest. public string FindUserGroup(string group) { //Search local computer using (DirectorySearcher searcher = new DirectorySearcher(new DirectoryEntry())) { searcher...

What is the easiest way to validate a UPN and a NT login name?

We allow our users to enter Active Directory account information using either an NT account name (domain\account) or a UPN (account@email,xxx). I would like to write some code to validate the account in active directory before allowing the user to move on. Note, we are not validating a password, just the account name. I can use UserPr...

Get unique identifier token of currently logged in AD user

I am working to set up SSO for our intranet the idea is that a user would login to their workstation using their active directory username and password. Then a small application would run at login that would send some uniquely identifiable information,user name, and computers MAC address to the server were it would be entered into a data...

How to retrieve user info fra a Active Directory Security Group using LDAP and PHP

As you can see below I'm not getting any user info when I do a LDAP search to the security group. I want to use the $_SERVER[remote_user] to check if the user is a member of this group. I would also like to retrieve the info of this user and update the sql database with it. Is this possible? $dn = "CN=Intra,OU=Common Security Groups,DC...

Active Directory Class Library

I've got the following setup in one library: BaseObject ObjectGuid ObjectClasses DisplayName CreatedDate (etc) User : BaseObject Surname MemberOf etc Group : BaseObject ... Computer : BaseObject ... Now I'm trying to create another library with a "Connector" class that communicates with Active Directory. One of its static memb...

Reading from a File in current User appdata folder for C#

I'm trying to read from a file inside a the current users appdata folder in C# but i'm still learning so I have this int counter = 0; string line; // Read the file and display it line by line. System.IO.StreamReader file = new System.IO.StreamReader("c:\\test.txt"); while ((line = fil...

Active directory employee number validation

I have this issue with new employee number format, when I search Active Directory for example with "07789", it returns me a result.But if I take the "0" off and search "7789" it will not find the record thinks 07789 and 7789 are different. But in the database the employee number field is an integer, so it always treats 07789 as 7789 and ...

Environment.CurrentDirectory renders Wrong Path

I need to get to a certain file in my ASP.NET MVC project. Have two folders in my same Project, let's call them Main and Reference. From my Main, I am calling a class from my Reference.csproj file. From there, I need to get to my TargetFile, which also lives in the Reference folder. When I use AppDomain.CurrentDomain.BaseDirectory i ge...

LDAP Authentication with Active Directory and SunOne

Hi All, I know how to authenticate username and password using LDAP after reviewing this site and others. But my question is our client does not give permission to any username or password to bind itself to active directory. I mean there is admin kind of uname and password which is used to bind first and then you have to provide your act...

How do I set the ManagedBy property on a GroupPrincipal

I'm creating and updating Groups in Active Directory using the GroupPrincipal class in System.DirectoryServices.AccountManagement. When creating and updating, I also need to be able to set the ManagedBy property that you are able to set in the Managed By tab in the groups properties in the AD management console. Can it be done program...

How to retreive Active Directory environment and session information with VB.Net

I'd like to be able to get and set the different information for a user in Active Directory on Windows Server 2003 under Environment and Session tabs through a VB.Net application. I am familiar with System.DirectoryService but I can not find the correct attributes for these particular tabs. For example, I'd like to check "Connect Printer...

How can I read the Active Directory schema programmatically

I did some programming for reading the data from Active Directory such as user account or Orgnization info and so on. The code below is like something what I did. DirectoryEntry entry = new DirectoryEntry( "LDAP://CN=Users,DC=domain,DC=com", null, null, AuthenticationTypes.Secure ); DirectorySearcher search = new Di...