directoryservices

A UserPrincipal equivalent to DirectoryEntry.Invoke?

你说的曾经没有我的故事 提交于 2019-12-10 18:53:00
问题 I'm updating code that interacts with the AD in our application. The current code uses the ActiveDs interface. I'm changing the code to use the System.DirectoryServices.AccountManagement namespace. Our application allows a user to store a password hint. This is stored in the AD under a user defined parameter. I know I can do this with the DirectoryEntry.Invoke("put") method. Is there anyway to do this with UserPrincipal, or do I need to call the GetUnderlyingObject method and then the

Calling commitChanges() does nothing in Active Directory?

亡梦爱人 提交于 2019-12-10 18:52:00
问题 It seems that the changes are not saving within ActiveDirectory despite me using the CommitChanges function. Am I using the correct approach to solve this issue? //Test OU Group: OU=First Group,OU=Domain Users,DC=DOMAIN,DC=com String userName, password; Console.Write("Username: "); userName = Console.ReadLine(); Console.Write("Password: "); password = Console.ReadLine(); //ENTER AD user account validation code here String strLDAPpath = "LDAP://OU=First Group,OU=Domain Uers,DC=DOMAIN,DC=com";

How would I validate a Username/Password using System.DirectoryServices.Protocol?

♀尐吖头ヾ 提交于 2019-12-10 17:52:40
问题 First, I cannot use Active Directory , so I cannot use System.DirectoryServices directly. This will be a PC sending a query to a Novell network where only System.DirectoryServices.Protocol is supported. I am pretty sure that I am down to needing to provide the proper SearchRequest. This is what I have so far: private static String _certificatePath; private static String _server; private static SearchResponse Query(String user, String pwd, out String error) { SearchResponse result = null;

Find computers in active directory

吃可爱长大的小学妹 提交于 2019-12-10 17:42:25
问题 When I manually search for a computer using dsa.msc and open its properties, there is a "Location" tab. It might or might not have a value in it. When I try to get this information using directory services of .Net, I do not see a "location" property. I printed out all available properties and don't see it. Is it just not available or am I missing something? This is partial code: string sADPath = "LDAP://blah.blah.com"; DirectoryEntry de = new DirectoryEntry(sADPath); string sFilter = "(&

LDAP search using DirectoryServices.Protocols slow

倾然丶 夕夏残阳落幕 提交于 2019-12-10 13:55:56
问题 We are using System.DirectoryServices.DirectorySearcher to do sAMAccountName lookups. This works fine except that when querying a certain AD, which we suspect is quite large, the search often times out. After doing a bit of research, I found out that searches using System.DirectoryServices.Protocols can be faster when querying against a large AD. I am trying to recreate what we have using Protocols to see if that will make any difference with the timeouts. This is what's currently there: Dim

..ActiveDirectory.ActiveDirectorySite.getComputerSite().name returns Error: ActiveDirectoryObjectNotFoundException

和自甴很熟 提交于 2019-12-10 03:08:53
问题 Thanks for viewing: Hopefully this not only helps others later, but helps us now! (and please be gentle, this my first Question on Stack though I've been a long time user/contributor) Situation (SNAFU) An AD Site aware application is pulling some information out of AD. This application must only connect to controllers within the Active Directory site the server is hosted; if no controllers are found for that site, we have bigger issues but code will handle that possibility. To accomplish this

How to use the objectGUID get a DirectoryEntry?

旧巷老猫 提交于 2019-12-09 19:17:54
问题 I know ,we can get a DirectoryEntry like this: string conPath = "LDAP://10.0.0.6/DC=wds,DC=gaga,DC=com"; string conUser = "administrator"; string conPwd = "Iampassword"; DirectoryEntry de = new DirectoryEntry(conPath, conUser, conPwd, AuthenticationTypes.Secure); and we can change a user's password like this: DirectorySearcher deSearch = new DirectorySearcher(); deSearch.SearchRoot = de; deSearch.Filter = String.Format("sAMAccountName={0}", "xumai"); SearchResultCollection results = deSearch

How to retrieve SAMAccountName from Active Directory

大城市里の小女人 提交于 2019-12-09 10:48:16
问题 I implemented a method that returns a list of Active Directory users, I would like to retrieve SAMAccountName like this Domain\Administrator . This is the method I use: public Collection<software_user> GetUsersFromAD(String adConnectionString) { var users = new Collection<software_user>(); using (var directoryEntry = new DirectoryEntry(adConnectionString)) { var directorySearcher = new DirectorySearcher(directoryEntry); directorySearcher.Filter = "(&(objectClass=user))"; var propertiesToLoad

Authenticating Domain Users with System.DirectoryServices

大憨熊 提交于 2019-12-08 23:58:38
问题 Given a username and a password for a domain user, what would be the best way to authenticate that user programatically? 回答1: It appears that .NET 3.5 added a new namespace to deal with this issue - System.DirectoryServices.AccountManagement. Code sample is below: Private Function ValidateExternalUser(ByVal username As String, ByVal password As String) As Boolean Using context As PrincipalContext = New PrincipalContext(ContextType.Domain, _defaultDomain) Return context.ValidateCredentials

Using DirectorySearcher to query multiple OUs

有些话、适合烂在心里 提交于 2019-12-08 08:09:47
问题 I have the following code: var directoryEntry = new DirectoryEntry(distributionListsListADSPath); var directorySearcher = new DirectorySearcher(directoryEntry) { SizeLimit = int.MaxValue, PageSize = int.MaxValue }; var result = directorySearcher.FindAll(); The problem is I want to search two seperate OUs. So what I do is run through this twice, once where private const string distributionListsListADSPath = "LDAP://OU=Distribution Lists,OU=Groups,DC=enron,DC=com"; and a second where it is