Questions tagged [directoryservices]
System.DirectoryServices is the .NET library used to access Microsoft's Active Directory, which holds information about users, groups, computers, permissions and more
769
questions
0
votes
1
answer
57
views
How to get active directory users with logon workstation in c#
I am writing a code for get all active directory user details with System.DirectoryServices but
i didn't find a way to get logon workstation (LogOnTo field) of each user.
Is there any way to get users ...
1
vote
0
answers
46
views
Updating user via System.DirectoryServices.AccountManagement library randomly results in 'Attempted to access an unloaded appdomain.' exceptions
We've implemented logic using System.DirectoryServices.AccountManagement (.NET Framework 4.5.2) to update user's Enabled flag. The issue is that we are sporadically receiving the following exception ...
0
votes
0
answers
26
views
Problem using a global variable in an LDAP request
My goal is to retrieve the OU names from an LDAP directory and according to each OU name display its sub OU.
All this in C# with a WPF interface.
My OU retrieval function is ok but the problem is with ...
0
votes
1
answer
100
views
How to upgrade a Console app from .net 5 to .net 7 to use DirectoryServices
To connect to an ldap-Server i want to use Directory Services in a c#-console application.
The services are available in dotnet-7.0
Therefore i need to upgrade from dotnet-5.0
These are the steps to ...
2
votes
1
answer
327
views
System.Directory Services not supported on windows platform
i am quite new to software development as well as to this site.
My question is about the System.DirectoryServices development on windows.
I started a normal Visual Studio 2019 c# .net 5.0 project and ...
0
votes
1
answer
42
views
What is the equivalent of Invoke("SetOption") in System.DirectoryServices.Protocols?
I have a legacy .NET library doing the following:
const int adsOptionPasswordMethod = 7;
const int adsPasswordEncodeClear = 0;
user.Invoke ("SetOption", new object[] { ...
0
votes
1
answer
40
views
C# Unit Test: How to create test input of COM Interop value?
In my application, there is a method which accepts an Object, then performs some operations on it to return a C# long value. At runtime, the Object received from Active Directory is an ...
0
votes
1
answer
43
views
Active Directory Query Users with contains ids from an array using C#
I am trying to perform a query to Active Directory to obtain all users where id is contained in the input array using a single query.
Is it possible? It
public List<Principal> Get(IEnumerable<...
0
votes
0
answers
102
views
System.DirectoryServices.AccountManagement nuget causing System.PlatformNotSupportedExceptionSystem.PlatformNotSupportedException
I have a web solution that has the System.DirectoryServices.AccountManagement nuget package installed so I could use the directory services API to check for user group membership. I deployed the ...
0
votes
1
answer
57
views
Query Active Directory for distinct values in a given field (e.g. Country) via DirectoryServices
I need to programmatically retrieve all of the distinct values in Active Directory for a given field (for example, the country field "co" - but I will have others) I don't care how many ...
0
votes
1
answer
26
views
How is PrincipalContext.ValidateCredentials call registered or marked on DC?
I am using PrincipalContext.ValidateCredentials method from System.DirectoryServices.AccountManagement namespace to validate user credentials against Active
Directory LDAP server. Sample of code:
...
0
votes
1
answer
362
views
How to do a search of LDAP user data on Apache Directory Studio with System.DirectoryServices?
I connected on LDAP Server of Apache Directory Studio and binded user with his credentials but now I want to fetch his own data like mail, telephone number etc. How to do that in System....
0
votes
1
answer
134
views
Checking write access on AD attributes (allowedAttributesEffective is empty)
A follow-up to How can I check if a user has write rights in Active Directory using C#?
I ran this to grant the user write access to an attribute:
dsacls "OU=Users,OU=OrgABC,DC=foo,DC=local" ...
1
vote
0
answers
144
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
1
answer
126
views
How do I get the domain name of a user from a machine not joined to the domain?
I am using SystemDirectorySevices to get user information from on-prem active directory from a machine not joined to the domain. The following code to get the user's domain name was working from a ...
2
votes
1
answer
341
views
PowerShell - Error when querying AD if user enters credentials
Trying to create a basic script for my IT helpdesk team that queries our AD to see if a computer's hostname is already on the domain. I want this to not require any modules so it can run on any ...
0
votes
0
answers
124
views
Forms Authentication with System.DirectoryServices (Active Directory)
A VB.NET application that I inherited authenticates users via Forms Authentication and System.DirectoryServices. The app is deployed to IIS 10, Windows 2016 server. After a random number of successful ...
0
votes
0
answers
79
views
Having Trouble retrieving "otherMobile" LDAP attribute vb.net
I am trying to retrieve "OtherMobile" attribute from AD. This is for an employee account recovery tool I am building. For some reason, I can't search on "otherMobile". Any ideas ...
0
votes
1
answer
83
views
Can not create object of DirectorySearcher class with Visual C++ with project reference of System.DirectoryServices.dll
System.DirectoryServices.dll file has been added successfully to Visual C++ project through References in Solution Explorer.
Microsoft Development Environment 2003 Version 7.1.3088.
Microsoft .Net ...
0
votes
0
answers
248
views
PrincipalContext.ValidateCredentials return false for some accounts
I've created a simple web app for users can change their domain account password. I'm using ASP.NET 6.0 with System.DirectoryServices library. The issue is with the ValidateCredentials method of the ...
3
votes
1
answer
4k
views
Unable to load shared library 'libldap-2.4.so.2' or one of its dependencies
Team,
I am getting the following error when trying to run on docker. its working fine on windows machine-
Unable to load shared library 'libldap-2.4.so.2' or one of its
dependencies. In order to help ...
0
votes
1
answer
112
views
Can I get updates (DirSync Cookie) in Active Directory with paging?
I am using DirSync Control (Cookie) to get the latest changes using the below technique. Is it possible to get that result with pagination ?
https://learn.microsoft.com/en-us/windows/win32/ad/polling-...
0
votes
2
answers
1k
views
LDAP Error: The user has insufficient access rights. : LdapErr: DSID-0C09099D, comment: Error processing control,
I want to get incremental changes from Active Directory using C# and for that I am trying to build a solution as mentioned in the following article (using DirSync Control).
https://learn.microsoft.com/...
1
vote
0
answers
942
views
System.DirectoryServices.Protocols on Linux Container
I am trying to connect to our AD server using System.DirectoryServices.Protocol but it cannot connect. Based on this, it seems to be able to support SSL for Linux Docker container.
But I tried it and ...
1
vote
2
answers
361
views
Unable to get Changes Using uSNChanged
I want to get incremental changes from Active Directory using C#. And for that I am trying to build a solution as mentioned in the following article.
https://learn.microsoft.com/en-us/windows/win32/ad/...
0
votes
0
answers
263
views
Connect with PrincipalContext to another domain
Our customer his server is located in the "a.local" domain.
There is an domain trust to "b.local".
From my application we allow the user to choose a domain first, and then fill in ...
0
votes
1
answer
150
views
Is it possible to add SearchResultCollections together? Or return more than one?
Im searching in ActiveDirectory, and I have to make things perform fast. Sadly, I need to search in different domains and different OU-s. My goal is to write a function that does multiple searches, ...
2
votes
2
answers
1k
views
Cannot get LDAP data using System.DirectoryServices.AccountManagement on IIS hosted app
I am using System.DirectoryServices.AccountManagement Package to get users data from LDAP and it works fine on my local machine but on server, it gives error saying:
**An operations error occurred.
at ...
1
vote
1
answer
185
views
Assembly 'system.directoryservices.accountmanagement' was not found in the SQL catalog
I am using Visual Studio to write CLR Assembly in VB.NeT for an SQL database.
While I try to deploy my project I get this error:
Assembly 'system.directoryservices.accountmanagement' was not found in
...
0
votes
1
answer
279
views
When using DirectoryEntry to get all children for local machine all children objects have identical GUIDs [duplicate]
I am using System.DirectoryServices to get all of the entries for the local machine. (non domain connected)
Like this:
public static List<DirectoryEntry> GetLocalMachineEntries()
{
List<...
6
votes
1
answer
264
views
InvalidCastException when trying to obtain UserPrincipal.Current
I have a PowerShell script which checks the currently signed in user as part of its start-up process. I'm using .Net to do this by adding the assembly:
Add-Type -AssemblyName System.DirectoryServices....
0
votes
1
answer
126
views
Segmentation fault (core dumped) when calling LdapConnection.SendRequest(SearchRequest req) at System.DirectoryServices.Protocols on Ubuntu 18.04.4LTS
When I try to get user information from Active Directory, LdapConnection.SendRequest(SearchRequest req) causes :
Segmentation fault (core dumped)
on an Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-147-generic ...
1
vote
0
answers
46
views
How Can I Expose the EmailAddress Attribute on the Principal Context during Development
I'm trying to retrieve users assigned to a specific AD group. During development there are a number of attributes that are not available, but are available at runtime. An example of this is the ...
1
vote
1
answer
155
views
How can I set an Extended UserPrincipal Array Property as empty with System.Directory.AccountManagement
As mentioned in the title I'm using the Principal Extensions of the Account Management API for getting and setting custom AD User attributes. Two of these custom attributes are string array. The ...
1
vote
0
answers
65
views
AD calls over 3269 querying non ssl DC servers
AD calls over 3269 are querying non ssl DC servers as not all Domain Controllers are ssl enabled in the forest.
AD calls(by passing global catalog server) should query at the forest level and in our ...
0
votes
1
answer
516
views
ASP.Net getting error on "UserPrincipal user = UserPrincipal.FindByIdentity(ctx, User.Identity.Name);"
I'm trying to deploy an ASP.net webapp - I was originally running the following code:
PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
UserPrincipal user = UserPrincipal.Current;...
1
vote
1
answer
187
views
"Properties" and "GetProperties" not available for UserPrincipal, unable to get 'Department' and other values
I'm trying to get the 'Departmment' value for AD Users, I have a UserPrincipal object, which I get using the following.
public ADUser getADUser(string sid)
{
ADUser ADUser = new ADUser();
...
0
votes
1
answer
139
views
C# - How do I Get a users "Web Page" property from Active Directory?
using System.DirectoryServices.AccountManagement;
string WebPage = "";
using (var context = new PrincipalContext(ContextType.Domain))
{
var usr = UserPrincipal.FindByIdentity(context, ...
0
votes
1
answer
424
views
How to get Domains from a forest from Active Directory over LDAP SSL in c#
I am currently using the following code to get Domains from current forest.
Forest currentForest = Forest.GetCurrentForest();
DomainCollection domainCollection = currentForest.Domains;
This method ...
1
vote
1
answer
144
views
C# - Directory Services - Randomly receive error roughly once a month
I have a windows service that queries Active Directory User information and writes it to a database. Randomly (I'd say once a month), it errors out and does NOT successfully restart. I was wondering ...
0
votes
1
answer
442
views
Add user to Active Directory Exception while calling Save function on UserPrincipal
I'm making a small forms application for adding a new user to Active Directory.
After creating the PrincipalContext, I'm making the UserPrincipal and setting the properties of it.
When I call Save on ...
0
votes
1
answer
87
views
My call to DirectoryServices.AccountManagement.FindByIdentity is failing. What am I missing?
I'm trying to verify all users in a table to make sure they still exist in AD. I modeled my code after the answer to this question. However, on the FindByIdentity call, it's giving me this error:
'...
0
votes
0
answers
145
views
How to set password according to default domain password policy for ad user in C#
I need to generate AD Users using C# DirectoryEntry way, but their passwords must meet the default domain password policy.
There are some random generators but they don't meet set the passwords ...
0
votes
1
answer
223
views
C# Best method to sync contacts to AD
I am creating a small utility that will grab user data from a source. That user data includes Full Name and Email, this source will be changing (updating, creating and deleting users).
What is the ...
0
votes
0
answers
162
views
Authenticate Workgroup users through Active Directory in C#
I have a Workgroup server that is running IIS with an app that connects to Active directory from another server to authenticate a username and password. I am able to get users from the active ...
3
votes
0
answers
2k
views
System.DirectoryServices.Protocol LDAP query results in unknown error returned from LDAP server
I am attempting to use System.DirectoryServices.Protocol to perform an LDAP query that I was able to perform successfully previously when I was using the Novell library.
Specifically, I am creating ...
1
vote
1
answer
356
views
Principal does not contain a definition for 'EmailAddress'
I'm trying to retrieve users from an OU on a Windows 2016 Service via a Windows Service App (to synchronise accounts to another service).
I've got the code below to search the OU and then add the ...
0
votes
1
answer
312
views
Getting Unknown error (0x80005000) with Directory services in asp .net, IIS 8 environment
Error is happening in the code shown here.
I tried the following based on google research, but still error persists
Ensured "LDAP" is in upper case
Installed II6 meatabase 6.
Error goes ...
0
votes
0
answers
186
views
LDAP Authentication problem with users who have restricted workstations
I use System.DirectoryServices to authenticate users against active directory.
this is my code
public bool Validate(string userId, string password)
{
try
{
string ...
1
vote
2
answers
3k
views
.NET Core Application and System.DirectoryServices in Docker container
I'm trying to put a .NET Core 3.1 application listing users in an AD group into a .NET Core Runtime Docker container.
Accessing the AD is being done with the help of a DirectorySearcher from the ...