21 questions
0
votes
1
answer
163
views
Using PrincipalSearcher to find users matching pattern
I have a somewhat particular situation I couldn't find answers to through google.
I need to query my active directory for users whose SAMAccountName fits a particular pattern (3 letters followed by 4 ...
1
vote
0
answers
255
views
C# finding all Microsoft Accounts on machine
I am trying to get the UPN and Microsoft Accounts for all users on my machine using C#.
I am currently logged into an Azure account, and whoami returns details as expected and that I am looking for (...
0
votes
0
answers
79
views
Is there a way of searching for a list of users on AD who have not logged on in the last year?
I am trying to find a way of getting a list of UserPrincipal objects that have not logged in for a year. There is a Last Logon property on the object, but I can't figure out how to do a less than ...
0
votes
2
answers
2k
views
Get AD Groups with ASP.NET WebAPI C# not working on Windows Server 2016 Datacenter
I have a ASP.NET Web API Application which loads all the Groups which contains a Specific Name from Active Directory into internal Database.
This was working on Dev. PC (Windows 10), Testserver and ...
0
votes
1
answer
438
views
How can I find computers with LastLogonTimestamp less than a certain date OR null
The following code returns all the computerprincipals that have logon date prior to 3 months ago but does not get those with null for a lastlogontimestamp
PrincipalContext context = new ...
1
vote
1
answer
1k
views
ldap principalsearcher very slow
I want to get information from only 1 user out of 20,000 users. The response time of the method I used below is 40 seconds. What is the solution to this problem?
public AuthenticatedUserProperties ...
0
votes
1
answer
2k
views
PrincipalSearcher Wrong Username Or Password error
I'm trying to get user data from the active directory. Authentication process is true.
var context = new PrincipalContext(ContextType.Domain, "localhost-ad.local", "OU=LocalOu,DC=localhost-ad,DC=...
1
vote
1
answer
2k
views
PrincipalContext: Exception Details: System.DirectoryServices.DirectoryServicesCOMException: An operations error occurred
I am trying to search AD for a user, but it keeps throwing an exception. The application is setup to use AppPool. and I am certain that the logged in user has access to search AD.
Code:
public ...
1
vote
1
answer
699
views
DirectorySearcher doesn't respect the SizeLimit property if the SizeLimit is 256 or over
I'm using PrincipalSearcher and DirectorySearcher to filter users and specify which properties to grab. On testing it on 2 different networks. One network has 8K+ records and the other has 135K+. On ...
1
vote
1
answer
535
views
Find if Active Directory is Enabled/Disabled with Email
I'm trying to find if a user has an Active Directory account by searching with their email address and checking the Enabled property (if I return Enabled as true - run code, if I return false - run ...
1
vote
1
answer
7k
views
Complex Search Filtering with PrincipalSearcher
I am searching in Active Directory for specific SamAccountName values using the PrincipalSearcher object because I want to return UserPrincipal's. I was wondering how I can apply two filters to that ...
1
vote
1
answer
3k
views
Get Count of members in a AD Group using PrincipalSearcher
Env : Visual Studio 2013, FrameWork 4.5, Telerik Controls, C#, WebForm application
Using : System.DirectoryServices and System.DirectoryServices.AccountManagement
I'm making a search tools so a user ...
0
votes
1
answer
406
views
How would i assign only DisplayName and Name from PrincipalSearcher to List?
I have the following sample code:
namespace DirectorySearcher
{
class Program
{
static void Main(string[] args)
{
using (var context = new PrincipalContext(ContextType.Domain, "...
4
votes
1
answer
4k
views
AD PrincipalSearcher: Search where property does not contain some value
Principal Searcher seems to do a great job when building a filter to find an object with a particular value. What about without? For example How do I build a filter to exclude everyone with "Joe" in ...
1
vote
2
answers
1k
views
How can i get all groups of a local user using ObjectQuery?
i try to display all groups a special User is in.
I also know, that i could do it like this:
public static List<Principal> getUsers(){
PrincipalContext context = new PrincipalContext(...
6
votes
2
answers
5k
views
Extend UserPrincipal class
I do the extension of the UserPrincipal class to retrieve some missing properties that i need:
[DirectoryObjectClass("user")]
[DirectoryRdnPrefix("CN")]
class UserPrincipalExt : UserPrincipal
{
...
1
vote
1
answer
3k
views
How to include multiple OU from AD account in a single search using PrincipleSearcher in asp.net c#
Scenario: Active Directory username search should return results against a search item (i.e. Firstname or Surname). There are 6 countries that are setup as different organizational units for AD ...
1
vote
1
answer
216
views
Active Directory - weird behaviour
I'm trying to get informations (members of groups).
I get every time the message "Information about the domain could not be retrieved (1355)"
For getting the groups, it helped to try it just 2 times....
1
vote
2
answers
5k
views
Search Users in Active Directory based on First Name, Last Name and Display Name
I trying to search my organization Active directory for users.
If the FirstName or LastName or DisplayName matches a particular string value, it should return the users.
My Code:
// create your ...
2
votes
1
answer
2k
views
Query PrincipalSearcher for containing multiple strings
I want to be able to query the active directory give a list of all groups containing certain words like Users or Administrators below is what i've got so far
PrincipalContext ctx = new ...
15
votes
2
answers
3k
views
Does PrincipalSearchResult<T> automatically dispose all elements in its collection?
Can't find anything in the MSDN documentation on this.
I.e. is it enough to do, say:
using(PrincipalSearcher searcher = ...)
{
foreach (var principal in searcher.FindAll())
{
... do ...